[MLIR] Fix 64-bit product during aten.view lowering (#3378)

std::accumulate needs 64-bit init value to perform 64-bit arithmetic on
a list of integers.

Signed-off-by: Gaurav Shukla <gaurav.shukla@amd.com>
pull/3382/head
Gaurav Shukla 2024-05-23 08:59:28 +05:30 committed by GitHub
parent d924d0047f
commit 43f961eca4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,8 @@ using namespace mlir::torch;
using namespace mlir::torch::Torch; using namespace mlir::torch::Torch;
static int64_t productReduce(ArrayRef<int64_t> a) { static int64_t productReduce(ArrayRef<int64_t> a) {
return accumulate(a.begin(), a.end(), /*init=*/1, std::multiplies<int64_t>()); return accumulate(a.begin(), a.end(), /*init=*/static_cast<int64_t>(1),
std::multiplies<int64_t>());
} }
template <typename OpTy, typename OpAdaptor> template <typename OpTy, typename OpAdaptor>