Skip to content

Commit a142f6f

Browse files
committed
refactor(aten::sum): Clarify code in sum converter
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 11fada5 commit a142f6f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/conversion/converters/impl/reduce.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,20 @@ auto reduce_registrations TRTORCH_UNUSED =
8080
[](ConversionCtx* ctx, const torch::jit::Node* n, args& args) -> bool {
8181
auto in_tensor = args[0].ITensorOrFreeze(ctx);
8282
auto dims = args[1].unwrapToIntList();
83-
c10::List<int64_t> dims_copy;
83+
c10::List<int64_t> calculated_dims;
8484
auto in_dims = util::toVec(in_tensor->getDimensions());
8585
LOG_DEBUG("InDims " << in_dims); // Some abuse of toDim but just for debug info
8686
LOG_DEBUG("Dim to reduce(original):" << util::toDims(dims)); // Some abuse of toDim but just for debug info
8787
for (int i = 0; i < dims.size(); i++) {
8888
auto dim_val = dims[i] == -1 ? (in_dims.size() - 1) : dims[i];
89-
dims_copy.push_back(dim_val);
89+
calculated_dims.push_back(dim_val);
9090
}
91-
92-
LOG_DEBUG("Dim to reduce(converted):" << util::toDims(dims_copy)); // Some abuse of toDim but just for debug info
91+
92+
LOG_DEBUG("Dim to reduce(converted):" << util::toDims(calculated_dims)); // Some abuse of toDim but just for debug info
9393

9494
uint32_t axis_mask = 0;
95-
for (size_t d = 0; d < dims_copy.size(); d++) {
96-
axis_mask |= 1 << dims_copy[d];
95+
for (size_t d = 0; d < calculated_dims.size(); d++) {
96+
axis_mask |= 1 << calculated_dims[d];
9797
}
9898
LOG_DEBUG("Axis Mask" << std::bitset<32>(axis_mask));
9999

0 commit comments

Comments
 (0)