From ebbe26f636ca84aa90bbfb97d5e11cb16667d957 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Wed, 23 Apr 2025 16:10:44 -0700 Subject: [PATCH] Fix `numel()` downcast in dper_lib/silvertorch/core/legacy/tools/eval/tests/TestUtil.cpp +2 Summary: `numel()` has type `int64_t`. The implicit downcasts fix in this change artificially truncate data ranges which can lead to hard-to-debug errors and SEVs. Using `auto` ensures that the correct data type is used. Reviewed By: dtolnay Differential Revision: D73533979 --- backends/cadence/fusion_g3/operators/op_mean.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/cadence/fusion_g3/operators/op_mean.cpp b/backends/cadence/fusion_g3/operators/op_mean.cpp index 48f691a145a..4509e19b5c7 100644 --- a/backends/cadence/fusion_g3/operators/op_mean.cpp +++ b/backends/cadence/fusion_g3/operators/op_mean.cpp @@ -106,7 +106,7 @@ Tensor& mean_out( const float* __restrict__ p_inp = (const float* __restrict__)in.const_data_ptr(); - int num_elm = in.numel(); + auto num_elm = in.numel(); int num_inp_dims = in.dim(); int num_out_dims = out.dim();