Skip to content

Commit

Permalink
fix some prefast warnings (microsoft#12730)
Browse files Browse the repository at this point in the history
fix warnings
  • Loading branch information
wangyems authored Aug 30, 2022
1 parent 9680ffd commit 9aefcc2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion onnxruntime/contrib_ops/cuda/bert/decoder_attention.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int64_t>(2 * hidden_size)) {
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "kv_weights shall have shape (hidden size, 2 * hidden size)");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ Status GreedySearchProcessLogits(
const Tensor& input = next_token_scores_value.Get<Tensor>();

constexpr int axis = 1;
const unsigned top_k = static_cast<unsigned>(1);
constexpr unsigned top_k = static_cast<unsigned>(1);
constexpr bool largest = true;
constexpr bool sorted = false;

Expand Down
10 changes: 5 additions & 5 deletions onnxruntime/test/contrib_ops/layer_norm_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ TEST(CudaKernelTest, LayerNorm_SmallSizeTensor) {

TEST(CudaKernelTest, LayerNorm_SmallSizeTensor_IntermediateAxis) {
const std::vector<int64_t> 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);
}

Expand All @@ -108,9 +108,9 @@ TEST(CudaKernelTest, LayerNorm_LargeSizeTensor) {

TEST(CudaKernelTest, LayerNorm_MidSizeTensor_NoBias) {
std::vector<int64_t> 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);
}

Expand All @@ -121,7 +121,7 @@ TEST(CudaKernelTest, SimplifiedLayerNorm_SmallSizeTensor) {

TEST(CudaKernelTest, SimplifiedLayerNorm_SmallSizeTensor_IntermediateAxis) {
const std::vector<int64_t> 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);
}

Expand Down

0 comments on commit 9aefcc2

Please sign in to comment.