Skip to content

Commit f830fa5

Browse files
committed
Fix IndicesEstimator constructor
Signed-off-by: Yuanyuan Chen <cyyever@outlook.com>
1 parent 3cefe05 commit f830fa5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

fbgemm_gpu/src/tbe/eeg/indices_estimator.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void IndicesEstimator::populateLogTable_() {
4545
}
4646
}
4747

48-
IndicesEstimator::IndicesEstimator(const torch::Tensor& indices) {
48+
IndicesEstimator::init(const torch::Tensor& indices) {
4949
TORCH_CHECK(
5050
indices.numel() > 0, "indices numel is ", indices.numel(), "(< 1)");
5151

@@ -62,6 +62,10 @@ IndicesEstimator::IndicesEstimator(const torch::Tensor& indices) {
6262
populateLogTable_();
6363
}
6464

65+
IndicesEstimator::IndicesEstimator(const torch::Tensor& indices) {
66+
init(indices);
67+
}
68+
6569
IndicesEstimator::IndicesEstimator(const std::filesystem::path& tensors_path) {
6670
// NOTE: PyTorch API requires us to use a torch::pickle_load on a
6771
// vector<char> (torch::load doesn't work here)
@@ -79,7 +83,7 @@ IndicesEstimator::IndicesEstimator(const std::filesystem::path& tensors_path) {
7983
assert((ival.isTensor()) && "Loaded file is not a tensor!");
8084

8185
// Pass it to the tensor-based constructor
82-
IndicesEstimator(ival.toTensor());
86+
init(ival.toTensor());
8387
}
8488

8589
std::vector<double> IndicesEstimator::heavyHitters() const {

fbgemm_gpu/src/tbe/eeg/indices_estimator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class IndicesEstimator {
3737
double estimateQuality(const IndicesDistributionParameters& params) const;
3838

3939
private:
40+
void init(const torch::Tensor& indices);
41+
4042
// Hardcoded parameters
4143
// Heavy hitter threshold: we make sure they account for >=90% of the mass or
4244
// the top 20 frequencies, whichever comes first. We also ensure that we cover

0 commit comments

Comments
 (0)