From 3c427a89464d046cfb19a514191aaa6f04750035 Mon Sep 17 00:00:00 2001 From: Ye Wang <52801275+wangyems@users.noreply.github.com> Date: Thu, 15 Sep 2022 15:53:57 -0700 Subject: [PATCH] Fix an arithmetic overflow warning (#12961) --- onnxruntime/contrib_ops/cuda/bert/decoder_attention.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime/contrib_ops/cuda/bert/decoder_attention.cc b/onnxruntime/contrib_ops/cuda/bert/decoder_attention.cc index 0cd0be1714..55dd56428a 100644 --- a/onnxruntime/contrib_ops/cuda/bert/decoder_attention.cc +++ b/onnxruntime/contrib_ops/cuda/bert/decoder_attention.cc @@ -85,7 +85,7 @@ Status CheckInputs(const TensorShape& query_shape, return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "q_weights shall have shape (hidden size, hidden size)"); } - if (kv_weights_dims[0] != hidden_size || kv_weights_dims[1] != static_cast(2 * hidden_size)) { + if (kv_weights_dims[0] != hidden_size || kv_weights_dims[1] != 2 * static_cast(hidden_size)) { return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "kv_weights shall have shape (hidden size, 2 * hidden size)"); } @@ -95,7 +95,7 @@ Status CheckInputs(const TensorShape& query_shape, bias_dims.size()); } - if (bias_dims[0] != 3 * hidden_size) { + if (bias_dims[0] != 3 * static_cast(hidden_size)) { return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "bias shall have shape (3 * hidden size)"); }