From 54e45ec38b49af9542341d71bb71636b44522f01 Mon Sep 17 00:00:00 2001 From: Yan Xiong Date: Fri, 5 Sep 2025 17:29:30 -0700 Subject: [PATCH 1/2] convert batch size to float before torch.std in params reporter Summary: X-link: https://github.com/facebookresearch/FBGEMM/pull/1854 ### Description This diff converts the batch size to a float before calculating the standard deviation in the `params_reporter` module. This change is made to ensure accurate calculations, as `torch.std` expects a floating-point input. ### Changes - **Modified code in `bench_params_reporter.py`** - Changed the line `torch.std(torch.tensor([b for bs in batch_size_per_feature_per_rank for b in bs]))` to `torch.std(torch.tensor([b for bs in batch_size_per_feature_per_rank for b in bs])).float()`. ### Reason The `torch.std` function requires a floating-point tensor to calculate the standard deviation. By converting the batch size to a float, we ensure that the calculation is performed correctly. Reviewed By: q10 Differential Revision: D81809491 --- fbgemm_gpu/fbgemm_gpu/tbe/stats/bench_params_reporter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fbgemm_gpu/fbgemm_gpu/tbe/stats/bench_params_reporter.py b/fbgemm_gpu/fbgemm_gpu/tbe/stats/bench_params_reporter.py index 5df112257e..9dc3372ce1 100644 --- a/fbgemm_gpu/fbgemm_gpu/tbe/stats/bench_params_reporter.py +++ b/fbgemm_gpu/fbgemm_gpu/tbe/stats/bench_params_reporter.py @@ -209,7 +209,7 @@ def extract_params( for bs in batch_size_per_feature_per_rank for b in bs ] - ) + ).float() ) ) ) From 8b481cf4acb03866117ece66a70af993a9db558c Mon Sep 17 00:00:00 2001 From: Yan Xiong Date: Fri, 5 Sep 2025 17:29:30 -0700 Subject: [PATCH 2/2] remove std out in EEG estimator Summary: ### Summary * Removed `std::cout` statements from `indices_estimator.cpp` to suppress output. Differential Revision: D81830197 --- fbgemm_gpu/src/tbe/eeg/indices_estimator.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fbgemm_gpu/src/tbe/eeg/indices_estimator.cpp b/fbgemm_gpu/src/tbe/eeg/indices_estimator.cpp index 73b330c17d..0f949603ea 100644 --- a/fbgemm_gpu/src/tbe/eeg/indices_estimator.cpp +++ b/fbgemm_gpu/src/tbe/eeg/indices_estimator.cpp @@ -163,16 +163,12 @@ ZipfParameters IndicesEstimator::zipfParams( if ((ratio < kHeavyHitterLowerBound_) || (ratio > kHeavyHitterUpperBound_)) { - std::cout << "Skipping (s,q) (" << s << ", " << q - << "): " << " inconsistent with heavy hitters!" << "\n"; continue; } double logLikelihood = -zipfTotalFreq * log(normalizeConst) + s * freqTerm - kQRegularizer_ * q; if (logLikelihood > maxLogLikelihood) { - std::cout << "Found best Log likelihood so far on (s,q) (" << s << ", " - << q << "): " << logLikelihood << "\n"; maxLogLikelihood = logLikelihood; zipfParams.q = q; zipfParams.s = s;