Skip to content

Commit

Permalink
VTEN-11-Fix-get_size-bug (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
shengtsui authored Nov 4, 2024
1 parent de7bf0a commit 35e19dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/core/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ using Shape = std::array<size_t, N>;
*/
template <size_t N>
size_t get_size(const Shape<N>& shape) {
return std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<size_t>());
size_t size = 1;
for (size_t i = 0; i < N; ++i) size *= shape[i];
return size;
}

/**
Expand Down

0 comments on commit 35e19dd

Please sign in to comment.