Skip to content

Commit 4edd225

Browse files
committed
change assertion to set
1 parent 522dceb commit 4edd225

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

beginner_source/onnx/onnx_registry_tutorial.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,10 @@ def custom_aten_add(input_x, input_y, alpha: float = 1.0):
128128
assert len(onnx_program.model_proto.graph.node) == 1
129129
# graph node name is the function name
130130
assert onnx_program.model_proto.graph.node[0].op_type == "custom_aten_add"
131-
# the function has three nodes
132-
assert len(onnx_program.model_proto.functions[0].node) == 3
133131
# function node domain is empty because we use standard ONNX operators
134-
assert onnx_program.model_proto.functions[0].node[2].domain == ""
132+
assert {node.domain for node in onnx_program.model_proto.functions[0].node} == {""}
135133
# function node name is the standard ONNX operator name
136-
assert onnx_program.model_proto.functions[0].node[2].op_type == "Add"
134+
assert {node.op_type for node in onnx_program.model_proto.functions[0].node} == {"Add", "Mul", "Constant"}
137135

138136

139137
######################################################################

0 commit comments

Comments
 (0)