Back out "[DDP][BE] Fix clang-tidy" (#73522)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73522
Original commit changeset: 41bcb2b9f617
Original Phabricator Diff: D34422578 (https://github.com/pytorch/pytorch/commit/590685dc6e7bd0af700d8a1c35c19d0a916dcda9)
ghstack-source-id: 150128504
Test Plan: unit tests
Reviewed By: rohan-varma
Differential Revision: D34527890
fbshipit-source-id: 33ca3c4d66cbae29a9d05e45e5886a4bd2c55b02
(cherry picked from commit 0e7f7299a2f851a899c667cdba7d4e6cb8f84fde)
diff --git a/torch/csrc/distributed/c10d/logger.cpp b/torch/csrc/distributed/c10d/logger.cpp
index d55eebc..4e01863 100644
--- a/torch/csrc/distributed/c10d/logger.cpp
+++ b/torch/csrc/distributed/c10d/logger.cpp
@@ -125,11 +125,11 @@
return per_bucket_variable_indices;
}
-std::vector<int64_t> Logger::get_bucket_sizes() {
- std::vector<int64_t> bucket_sizes;
+std::vector<int> Logger::get_bucket_sizes() {
+ std::vector<int> bucket_sizes;
for (const auto& bucket : reducer_->buckets_) {
const auto& variables = bucket.variables;
- int64_t bucket_size = 0;
+ int bucket_size = 0;
for (const auto& v : variables) {
bucket_size += v.numel() * v.element_size();
}
diff --git a/torch/csrc/distributed/c10d/logger.hpp b/torch/csrc/distributed/c10d/logger.hpp
index 62c678d..07174d4 100644
--- a/torch/csrc/distributed/c10d/logger.hpp
+++ b/torch/csrc/distributed/c10d/logger.hpp
@@ -41,7 +41,7 @@
// Set parameters stats.
void set_parameter_stats();
// Get size of each bucket (Bytes).
- std::vector<int64_t> get_bucket_sizes();
+ std::vector<int> get_bucket_sizes();
// Get bucket size limits specified during DDP construction.
std::vector<int> get_bucket_size_limits();
// Get variable indices for each bucket.
diff --git a/torch/csrc/distributed/c10d/reducer.cpp b/torch/csrc/distributed/c10d/reducer.cpp
index 0ad874b..daef3f7 100644
--- a/torch/csrc/distributed/c10d/reducer.cpp
+++ b/torch/csrc/distributed/c10d/reducer.cpp
@@ -1906,7 +1906,7 @@
// composite key of a tensor's type identifier and its device.
struct BucketKey {
BucketKey(c10::ScalarType type, c10::Device device)
- : type(type), device(device) {}
+ : type(std::move(type)), device(std::move(device)) {}
const c10::ScalarType type;
const c10::Device device;