mshr-h commented on code in PR #19566:
URL: https://github.com/apache/tvm/pull/19566#discussion_r3252469416
##########
tests/python/relax/test_frontend_onnx.py:
##########
@@ -591,6 +591,51 @@ def test_binary(op_name: str):
verify_binary_scalar(op_name)
+def test_div_integer_constant_zero_divisor_raises_valueerror():
+ b_init = numpy_helper.from_array(np.array([3, 0, -2, 1], dtype=np.int32),
name="b")
+ node = helper.make_node("Div", ["a", "b"], ["y"])
+ graph = helper.make_graph(
+ [node],
+ "div_const_zero",
+ [helper.make_tensor_value_info("a", TensorProto.INT32, [4])],
+ [helper.make_tensor_value_info("y", TensorProto.INT32, [4])],
+ initializer=[b_init],
+ )
+ model = helper.make_model(graph, opset_imports=[helper.make_opsetid("",
18)])
+ model.ir_version = 9
+
+ with pytest.raises(
+ ValueError, match="ONNX Div with integer inputs encountered divisor
value 0"
+ ):
+ from_onnx(model, opset=18, keep_params_in_input=False)
+
+
+def test_div_integer_dynamic_nonzero_matches_ort():
Review Comment:
Do we really need to add this test? It looks like it is already covered by
test_binary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]