Skip to content

Commit 1062c9f

Browse files
committed
Addressing comments
1 parent 36cf9c4 commit 1062c9f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

onnxruntime/core/providers/cpu/nn/conv_transpose_attributes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct ConvTransposeAttributes : public ConvAttributes {
149149
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,
150150
"Dynamic pads tensor must be 1-D. Got rank: ", Pads->Shape().NumDimensions());
151151
}
152-
const int64_t expected_pads_size = static_cast<int64_t>(kernel_shape.size()) * 2;
152+
const int64_t expected_pads_size = SafeInt<int64_t>(kernel_shape.size()) * 2;
153153
const int64_t actual_pads_size = Pads->Shape().SizeFromDimension(0);
154154
if (actual_pads_size != expected_pads_size) {
155155
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,

onnxruntime/core/providers/cuda/nn/conv_transpose.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,14 @@ Status ConvTranspose<T, Layout>::UpdateState(OpKernelContext* context, bool dyna
275275
// both must have at least 3 dimensions. Check before dims-changed comparison because
276276
// a scalar (rank 0) has empty dims which matches the default-initialized last_x_dims,
277277
// causing the validation block to be skipped entirely.
278-
const int rank = static_cast<int>(x_shape.NumDimensions());
278+
const size_t rank = x_shape.NumDimensions();
279279
if (rank < 3) {
280280
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,
281281
"Input X must have at least 3 dimensions (N x C x D1...Dn).",
282282
" X: ", x_shape.ToString().c_str());
283283
}
284284

285-
if (static_cast<int>(w_shape.NumDimensions()) < 3) {
285+
if (w_shape.NumDimensions() < 3) {
286286
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,
287287
"Filter W must have at least 3 dimensions (C x M/group x k1...kn).",
288288
" W: ", w_shape.ToString().c_str());

0 commit comments

Comments
 (0)