ashutosh-arm commented on code in PR #11732:
URL: https://github.com/apache/tvm/pull/11732#discussion_r899281864
##########
tests/python/contrib/test_cmsisnn/test_binary_ops.py:
##########
@@ -145,6 +145,58 @@ def test_op_int8(
)
+@skip_if_no_reference_system
[email protected]_cmsisnn
[email protected]("op", [relay.qnn.op.mul, relay.qnn.op.add])
[email protected]("relu_type", ["RELU", "NONE"])
+def test_same_input_to_binary_op(op, relu_type):
+ """Tests QNN binary operator for CMSIS-NN where both inputs are the same"""
+ interface_api = "c"
+ use_unpacked_api = True
+ test_runner = AOT_USMP_CORSTONE300_RUNNER
+
+ dtype = "int8"
+ shape = [1, 16, 16, 3]
+ input_ = generate_variable("input")
+ input_scale = 0.256
+ input_zero_point = 33
+
+ model = make_model(
+ op,
+ input_,
+ input_,
+ input_scale,
+ input_zero_point,
+ input_scale,
+ input_zero_point,
+ relu_type,
+ )
+ orig_mod = make_module(model)
+
+ cmsisnn_mod = cmsisnn.partition_for_cmsisnn(orig_mod)
+
+ # validate pattern matching
+ assert_partitioned_function(orig_mod, cmsisnn_mod)
+
+ # validate the output
+ in_min, in_max = get_range_for_dtype_str(dtype)
+ inputs = {
+ "input": np.random.randint(in_min, high=in_max, size=shape,
dtype=dtype),
+ }
+ output_list = generate_ref_data(orig_mod["main"], inputs)
+ compile_and_run(
Review Comment:
I have added a check for this above in L182. Thanks @Mousius.
--
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]