fix some prefast warnings (#12730)

fix warnings
This commit is contained in:
Ye Wang 2022-08-30 12:52:59 -07:00 committed by GitHub
parent 9680ffd842
commit 9aefcc251f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -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)");
}

View file

@ -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;

View file

@ -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);
}
@ -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);
}
@ -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);
}