[Distributed] [7/N] Fix clang-tidy warnings in torch/csrc/distributed/c10d (#124987)

This PR continues to clean clang-tidy warnings in torch/csrc/distributed/c10d, following #124701. In addition, libfmt dependency is added in CMake code to enable using it in the headers. The libfmt has to be added as private dependency to torch_cuda and torch_hip because they include torch/csrc/distributed/c10d/Utils.hpp which uses libfmt.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/124987
Approved by: https://github.com/malfet
This commit is contained in:
cyy
2024-04-27 07:22:27 +00:00
committed by PyTorch MergeBot
parent ce503c1b40
commit b3fd94d15e
16 changed files with 96 additions and 72 deletions

View File

@ -30,10 +30,10 @@ class Counter {
return count_;
}
double variance() const noexcept {
return m2_ / count_;
return m2_ / static_cast<double>(count_);
}
double sample_variance() const noexcept {
return m2_ / (count_ - 1);
return m2_ / static_cast<double>(count_ - 1);
}
private: