Remove unnecessary use of c10::SmallVector from moments_utils (#156714)

It's just making arrays of a particular size. (If it was resizing the vectors, we'd see compile errors.)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/156714
Approved by: https://github.com/Skylion007
This commit is contained in:
Scott Wolchok
2025-06-24 09:30:20 -07:00
committed by PyTorch MergeBot
parent 4ee4863232
commit e96f530af5

View File

@ -8,7 +8,6 @@
#include <ATen/OpMathType.h> #include <ATen/OpMathType.h>
#include <ATen/cpu/vec/vec.h> #include <ATen/cpu/vec/vec.h>
#include <ATen/native/cpu/utils.h> #include <ATen/native/cpu/utils.h>
#include <c10/util/SmallVector.h>
#include <c10/util/irange.h> #include <c10/util/irange.h>
namespace at::native { namespace at::native {
@ -118,9 +117,11 @@ std::pair<opmath_t<T>, opmath_t<T>> RowwiseMomentsImpl(const T* X, int64_t N, in
using Vec = vec::Vectorized<math_t>; using Vec = vec::Vectorized<math_t>;
const Vec kZeroVec(math_t(0)); const Vec kZeroVec(math_t(0));
c10::SmallVector<int64_t, kMaxDepth> m0_stk(depth, 0); std::array<int64_t, kMaxDepth> m0_stk = {{0}};
c10::SmallVector<Vec, kMaxDepth> m1_stk(depth, kZeroVec); std::array<Vec, kMaxDepth> m1_stk;
c10::SmallVector<Vec, kMaxDepth> m2_stk(depth, kZeroVec); m1_stk.fill(kZeroVec);
std::array<Vec, kMaxDepth> m2_stk;
m2_stk.fill(kZeroVec);
for (const auto i : c10::irange(m)) { for (const auto i : c10::irange(m)) {
const T* X_ptr = X + i * kChunkSize * kVecSize; const T* X_ptr = X + i * kChunkSize * kVecSize;