diff --git a/onnxscript/rewriter/pattern.py b/onnxscript/rewriter/pattern.py index 806ebc09e..164b92f1e 100644 --- a/onnxscript/rewriter/pattern.py +++ b/onnxscript/rewriter/pattern.py @@ -110,7 +110,7 @@ def _to_attr_pattern(value: AttrPattern | ValuePattern | SupportedAttrTypes) -> """Represents promotion of values allowed as keyword-arguments in a pattern-builder call to an AttrPattern.""" if isinstance(value, AttrPattern): return value - if type(value) == ValuePattern: + if type(value) is ValuePattern: # This is a hack. Currently, when we create pattern-variables, we create them as ValuePattern, # and change them to AttrPattern if/when used in an attribute context. We could use type # annotations to distinguish between ValuePattern and AttrPattern, but forces users to diff --git a/onnxscript/testing/__init__.py b/onnxscript/testing/__init__.py index c731f6e95..f7bb74980 100644 --- a/onnxscript/testing/__init__.py +++ b/onnxscript/testing/__init__.py @@ -389,7 +389,7 @@ def assert_onnx_proto_equal( a: The first ONNX proto. b: The second ONNX proto. """ - assert type(a) == type(b), f"Type not equal: {type(a)} != {type(b)}" # pylint: disable=unidiomatic-typecheck + assert type(a) is type(b), f"Type not equal: {type(a)} != {type(b)}" a_fields = {field.name: value for field, value in a.ListFields()} b_fields = {field.name: value for field, value in b.ListFields()}