Skip to content

Commit 121db50

Browse files
author
Ashutosh Parkhi
committed
Review comment: Additional check for correct number of arguments in composite function
Change-Id: I7ffd6074bbbe9020b6efe64d48b80f79714ce8bd
1 parent dd2f205 commit 121db50

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

python/tvm/relay/op/contrib/cmsisnn.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ def qnn_max_pool2d_pattern():
229229
def check_qnn_max_pool2d(pattern):
230230
"""Check if max pool2d is supported by CMSIS-NN."""
231231
output = pattern
232-
input_op = None
233232

234233
if str(pattern.op.name) == "clip":
235234
pooling = pattern.args[0]

tests/python/contrib/test_cmsisnn/test_binary_ops.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ def test_same_input_to_binary_op(op, relu_type):
178178
# validate pattern matching
179179
assert_partitioned_function(orig_mod, cmsisnn_mod)
180180

181+
# Check if the number of internal function parameter is 1
182+
cmsisnn_global_func = cmsisnn_mod["tvmgen_default_cmsis_nn_main_0"]
183+
assert (
184+
isinstance(cmsisnn_global_func.body, tvm.relay.expr.Call)
185+
and len(cmsisnn_global_func.body.args) == 1
186+
), "Composite function for the binary op should have only 1 parameter."
187+
181188
# validate the output
182189
in_min, in_max = get_range_for_dtype_str(dtype)
183190
inputs = {

tests/python/contrib/test_cmsisnn/test_scalar_to_tensor_constant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def test_duplicate_constant_arguments():
262262
dtype = "int8"
263263
shape = (1, 3, 3, 32)
264264
operand0 = generate_variable("operand0", shape, dtype)
265-
operand1 = generate_variable("operand0", shape, dtype)
265+
operand1 = generate_variable("operand1", shape, dtype)
266266
binary_op = make_binary_op(
267267
relay.qnn.op.add,
268268
operand0,

0 commit comments

Comments
 (0)