From 6c8538f0862f213ba8df3ffde67e81024a7a810f Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Fri, 3 Mar 2023 12:54:28 -0800 Subject: [PATCH] Fix prefast warning (#14895) Fix a prefast warning: `The const variable 'spatial_dim_start' can be computed at compile-time. Consider using constexpr (con.5).` --- onnxruntime/core/providers/cuda/nn/conv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/cuda/nn/conv.cc b/onnxruntime/core/providers/cuda/nn/conv.cc index b0df77db96..bb2755f54a 100644 --- a/onnxruntime/core/providers/cuda/nn/conv.cc +++ b/onnxruntime/core/providers/cuda/nn/conv.cc @@ -173,7 +173,7 @@ Status Conv::UpdateState(OpKernelContext* context, bool bias_expected) TensorShapeVector slice_axes; slice_axes.reserve(kernel_rank); - const size_t spatial_dim_start = channels_last ? 1 : 2; + constexpr size_t spatial_dim_start = channels_last ? 1 : 2; const size_t spatial_dim_end = spatial_dim_start + kernel_rank; TensorShape spatial_shape = X->Shape().Slice(spatial_dim_start, spatial_dim_end);