Skip to content

Commit 8f6c474

Browse files
Copilotgramalingam
andcommitted
Address reviewer feedback: remove outdated comment and simplify graph iteration
Co-authored-by: gramalingam <10075881+gramalingam@users.noreply.github.com>
1 parent af8d520 commit 8f6c474

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

onnxscript/rewriter/pattern_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,6 @@ def test_pattern_match_with_value_checker(self):
860860
"""Test Pattern.match with value-level checker."""
861861

862862
def is_positive_constant(context, value: ir.Value):
863-
"""Check if value has a const_value, and check if that const_value (a numpy array) represents a single value that is positive."""
864-
# First try the direct const_value
865863
if value.const_value is not None:
866864
# Get the numpy array from const_value
867865
numpy_array = value.const_value.numpy()
@@ -905,8 +903,7 @@ def add_pattern(op, x, y):
905903
onnxscript.optimizer.basic_constant_propagation(model.graph.all_nodes())
906904

907905
# Find the Add nodes in the model
908-
nodes = list(model.graph)
909-
add_nodes = [node for node in nodes if node.op_type == "Add"]
906+
add_nodes = [node for node in model.graph if node.op_type == "Add"]
910907
self.assertEqual(len(add_nodes), 3)
911908

912909
# Test case 1: Non-constant first parameter - should not match

0 commit comments

Comments
 (0)