Skip to content

Commit

Permalink
Size check
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Chu <justinchu@microsoft.com>
  • Loading branch information
justinchuby committed Sep 13, 2023
1 parent 5d702f8 commit 5eea907
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion onnx/defs/math/defs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3020,7 +3020,8 @@ ONNX_OPERATOR_SET_SCHEMA(
// Skip if axis is not known
return;
}
if (axis_tensor->dims_size() != 1) {
// TODO(justinchuby): Create invariance checking functions to ensure shapes and sizes
if (axis_tensor->dims_size() != 0) {
fail_shape_inference("axis input must be a scalar.");
}
const int64_t axis = ONNX_NAMESPACE::defs::math::utils::GetScalarValueFromTensor<int64_t>(axis_tensor);
Expand Down

0 comments on commit 5eea907

Please sign in to comment.