diff --git a/onnxruntime/contrib_ops/cuda/bert/decoder_attention.cc b/onnxruntime/contrib_ops/cuda/bert/decoder_attention.cc index 482350dd881a0..0cd0be1714471 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] != 2 * hidden_size) { + if (kv_weights_dims[0] != hidden_size || kv_weights_dims[1] != static_cast(2 * hidden_size)) { return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "kv_weights shall have shape (hidden size, 2 * hidden size)"); } diff --git a/onnxruntime/contrib_ops/cuda/transformers/generation_device_helper.cc b/onnxruntime/contrib_ops/cuda/transformers/generation_device_helper.cc index eb0c3b528345f..d0875dbab731d 100644 --- a/onnxruntime/contrib_ops/cuda/transformers/generation_device_helper.cc +++ b/onnxruntime/contrib_ops/cuda/transformers/generation_device_helper.cc @@ -510,7 +510,7 @@ Status GreedySearchProcessLogits( const Tensor& input = next_token_scores_value.Get(); constexpr int axis = 1; - const unsigned top_k = static_cast(1); + constexpr unsigned top_k = static_cast(1); constexpr bool largest = true; constexpr bool sorted = false; diff --git a/onnxruntime/test/contrib_ops/layer_norm_test.cc b/onnxruntime/test/contrib_ops/layer_norm_test.cc index 9c41f218a2f2f..66a8632ff2ae4 100644 --- a/onnxruntime/test/contrib_ops/layer_norm_test.cc +++ b/onnxruntime/test/contrib_ops/layer_norm_test.cc @@ -92,7 +92,7 @@ TEST(CudaKernelTest, LayerNorm_SmallSizeTensor) { TEST(CudaKernelTest, LayerNorm_SmallSizeTensor_IntermediateAxis) { const std::vector X_dims{4, 20, 8, 16}; - const int64_t axis = -2; + constexpr int64_t axis = -2; TestLayerNorm(X_dims, LAYER_NORM_OP, k_epsilon_default, axis); } @@ -108,9 +108,9 @@ TEST(CudaKernelTest, LayerNorm_LargeSizeTensor) { TEST(CudaKernelTest, LayerNorm_MidSizeTensor_NoBias) { std::vector X_dims{8, 80, 768}; - const int64_t axis = -1; - const int64_t keep_dims = 1; - const bool no_bias = true; + constexpr int64_t axis = -1; + constexpr int64_t keep_dims = 1; + constexpr bool no_bias = true; TestLayerNorm(X_dims, LAYER_NORM_OP, k_epsilon_default, axis, keep_dims, no_bias); } @@ -121,7 +121,7 @@ TEST(CudaKernelTest, SimplifiedLayerNorm_SmallSizeTensor) { TEST(CudaKernelTest, SimplifiedLayerNorm_SmallSizeTensor_IntermediateAxis) { const std::vector X_dims{4, 20, 8, 16}; - const int64_t axis = -2; + constexpr int64_t axis = -2; TestLayerNorm(X_dims, SIMPLIFIED_LAYER_NORM_OP, k_epsilon_default, axis); }