Skip to content

Commit e6d6ad6

Browse files
committed
Update
[ghstack-poisoned]
1 parent c66f533 commit e6d6ad6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

kernels/portable/cpu/util/reduce_util.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ size_t get_reduced_dim_product(
8585
}
8686
size_t dim_product = 1;
8787
if (!dim.has_value()) {
88-
for (size_t i = 0; i < static_cast<size_t>(in.dim()); ++i) {
89-
dim_product *= in.size(i);
90-
}
91-
return dim_product;
88+
return in.numel();
9289
}
9390
const size_t d = _normalize_non_neg_d(dim.value(), in.dim());
9491
return in.size(d);
@@ -107,10 +104,7 @@ size_t get_reduced_dim_product(
107104
size_t dim_product = 1;
108105
const size_t in_dim = in.dim();
109106
if (!dim_list.has_value() || dim_list.value().size() == 0) {
110-
for (size_t i = 0; i < static_cast<size_t>(in.dim()); ++i) {
111-
dim_product *= in.size(i);
112-
}
113-
return dim_product;
107+
return in.numel();
114108
}
115109
for (const auto& d : dim_list.value()) {
116110
const size_t non_neg_d = _normalize_non_neg_d(d, in_dim);

0 commit comments

Comments
 (0)