Skip to content

Conversation

@justinchuby
Copy link
Collaborator

This pull request refactors how operator schemas are handled throughout the autocast, converter, and evaluator modules. The main change is replacing direct usage of OpSchema with a new _schemas.OpSignature abstraction, leading to more consistent and modular code when dealing with operator signatures, especially for input casting and evaluation. Several related methods are renamed and refactored for clarity and encapsulation.

Operator signature abstraction and autocast refactor:

  • Replaced usage of OpSchema with _schemas.OpSignature in onnxscript/_internal/autocast.py, updating all relevant function signatures and internal logic to use the new abstraction. This includes changing how input parameters are filtered and type constraints are accessed.

AST Converter integration:

  • Updated the converter (onnxscript/_internal/converter.py) to pass op_signature instead of op_schema to autocast functions, ensuring compatibility with the new signature abstraction.

Evaluator refactor and encapsulation:

  • Refactored the evaluator (onnxscript/_internal/evaluator.py) to use _adapt_inputs, _adapt_attributes, and _adapt_outputs methods, encapsulating the logic for adapting inputs/outputs and removing unused or redundant methods. Now, operator signatures are consistently adapted from OpSchema using _schemas.OpSignature.

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jan 15, 2026

❌ 24 Tests Failed:

Tests completed Failed Passed Skipped
680 24 656 2962
View the top 3 failed test(s) by shortest run time
onnxscript.tensor_test.TestTensor::test_getitem_gather
Stack Traces | 0.002s run time
onnxscript\tensor_test.py:137: in test_getitem_gather
    y = x[indices_0_and_3]
        ^^^^^^^^^^^^^^^^^^
onnxscript\tensor.py:155: in __getitem__
    result = op.Gather(result, value, axis=axis)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:967: in Gather
    return op(*self._prepare_inputs(schema, data, indices), axis=axis)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript.tensor_test.TestTensor::test_getitem_index
Stack Traces | 0.002s run time
onnxscript\tensor_test.py:73: in test_getitem_index
    y = x[0]
        ^^^^
onnxscript\tensor.py:118: in __getitem__
    scalar_indices.append([s, s + 1, axis_, 1])
                              ^^^^^
onnxscript\tensor.py:177: in __add__
    return self._opset.Add(self, other)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset14.py:81: in Add
    return op(*self._prepare_inputs(schema, A, B))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_graph_attr_loop_error
Stack Traces | 0.003s run time
onnxscript\_internal\converter_test.py:498: in test_graph_attr_loop_error
    sum_to_error(input)
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\graph_attr.py:50: in sum_to_error
    zero = op.Constant(value_int=0)
           ^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript.tensor_test.TestTensor::test_getitem_slice
Stack Traces | 0.003s run time
onnxscript\tensor_test.py:98: in test_getitem_slice
    y = x[0:2]
        ^^^^^^
onnxscript\tensor.py:149: in __getitem__
    result = op.Slice(self, starts, ends, axes, steps)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:3544: in Slice
    return op(*self._prepare_inputs(schema, data, starts, ends, axes, steps))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript.tensor_test.TestTensor::test_getitem_index_and_slice
Stack Traces | 0.005s run time
onnxscript\tensor_test.py:119: in test_getitem_index_and_slice
    y = x[0:2, 0]
        ^^^^^^^^^
onnxscript\tensor.py:118: in __getitem__
    scalar_indices.append([s, s + 1, axis_, 1])
                              ^^^^^
onnxscript\tensor.py:177: in __add__
    return self._opset.Add(self, other)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset14.py:81: in Add
    return op(*self._prepare_inputs(schema, A, B))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_empty_floats_attribute
Stack Traces | 0.006s run time
onnxscript\_internal\converter_test.py:650: in test_empty_floats_attribute
    self.check_run(empty_floats, [], expected)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\converter_test.py:647: in empty_floats
    return op.Constant(value_floats=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_graph_attr_loop
Stack Traces | 0.006s run time
onnxscript\_internal\converter_test.py:491: in test_graph_attr_loop
    self.check_run(sum_to, inputs, expected_output)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\graph_attr.py:35: in sum_to
    zero = op.Constant(value_int=0)
           ^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_opt_input
Stack Traces | 0.006s run time
onnxscript\_internal\converter_test.py:303: in test_opt_input
    from tests.models import opt_input
tests\models\opt_input.py:38: in <module>
    def option2(X, Bias=op.Constant(value=make_tensor("zero", TensorProto.FLOAT, [1], [0]))):
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_empty_ints_attribute
Stack Traces | 0.007s run time
onnxscript\_internal\converter_test.py:642: in test_empty_ints_attribute
    self.check_run(empty_ints, [], expected)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\converter_test.py:639: in empty_ints
    return op.Constant(value_ints=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_float_list_as_tensor_attribute
Stack Traces | 0.007s run time
onnxscript\_internal\converter_test.py:682: in test_float_list_as_tensor_attribute
    self.check_run(float_list_as_tensor, [], expected)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\converter_test.py:679: in float_list_as_tensor
    return op.Constant(value=[13.0, 17.0])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_int_as_tensor_attribute
Stack Traces | 0.007s run time
onnxscript\_internal\converter_test.py:658: in test_int_as_tensor_attribute
    self.check_run(int_as_tensor, [], expected)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\converter_test.py:655: in int_as_tensor
    return op.Constant(value=17)
           ^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_int_list_as_tensor_attribute
Stack Traces | 0.007s run time
onnxscript\_internal\converter_test.py:666: in test_int_list_as_tensor_attribute
    self.check_run(int_list_as_tensor, [], expected)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\converter_test.py:663: in int_list_as_tensor
    return op.Constant(value=[13, 17])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_loop_outer_scope
Stack Traces | 0.009s run time
onnxscript\_internal\converter_test.py:507: in test_loop_outer_scope
    self.check_run(loop_add, inputs, expected_output)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\graph_attr.py:66: in loop_add
    result = op.Loop(M, None, X, body=LoopBody)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:1789: in Loop
    return op(*self._prepare_inputs(schema, M, cond, *v_initial), body=body)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.evaluator_test.ORTEvaluatorTest::test_it_ignores_unknown_function_kwargs_when_option_set_to_true
Stack Traces | 0.01s run time
onnxscript\_internal\evaluator_test.py:51: in test_it_ignores_unknown_function_kwargs_when_option_set_to_true
    output = test_function(x, unknown=42)  # pylint: disable=unexpected-keyword-arg
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator_test.py:46: in test_function
    return op.Add(x, y)
           ^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset14.py:81: in Add
    return op(*self._prepare_inputs(schema, A, B))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_float_as_tensor_attribute
Stack Traces | 0.011s run time
onnxscript\_internal\converter_test.py:674: in test_float_as_tensor_attribute
    self.check_run(float_as_tensor, [], expected)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\converter_test.py:671: in float_as_tensor
    return op.Constant(value=17.0)
           ^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.evaluator_test.EvaluatorTest::test_evaluator
Stack Traces | 0.014s run time
onnxscript\_internal\evaluator_test.py:30: in test_evaluator
    output = seq_map(x)
             ^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator_test.py:17: in seq_map
    seq1 = op.SequenceConstruct(x, x + 1, x + 2)
                                   ^^^^^
onnxscript\tensor.py:177: in __add__
    return self._opset.Add(self, other)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset14.py:81: in Add
    return op(*self._prepare_inputs(schema, A, B))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_loop_inside_if
Stack Traces | 0.034s run time
onnxscript\_internal\converter_test.py:693: in test_loop_inside_if
    self.check_run(sum, [np.array(5, dtype=np.int64)], np.array(10, dtype=np.int64))
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\converter_test.py:687: in sum
    sum = op.Constant(value=0)
          ^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_eager_op
Stack Traces | 0.04s run time
onnxscript\_internal\converter_test.py:145: in test_eager_op
    res = eager_op.eager_op(x)
          ^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\eager_op.py:12: in eager_op
    return X % 1.5
           ^^^^^^^
onnxscript\tensor.py:166: in __mod__
    return self._opset.Mod(self, other, fmod=1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:1974: in Mod
    return op(*self._prepare_inputs(schema, A, B), fmod=fmod)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_sequences
Stack Traces | 0.076s run time
onnxscript\_internal\converter_test.py:374: in test_sequences
    eager_mode = sequences.make_sequence_tensor(A)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\sequences.py:11: in make_sequence_tensor
    seq = op.SequenceEmpty()
          ^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset11.py:3328: in SequenceEmpty
    return op(dtype=dtype)
           ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_loops_while
Stack Traces | 0.101s run time
onnxscript\_internal\converter_test.py:427: in test_loops_while
    res = loops_while.loop_range_cond_only(x)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\loops_while.py:25: in loop_range_cond_only
    cond = op.Constant(value=make_tensor("true", TensorProto.BOOL, [], [1]))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_graph_attr_scan
Stack Traces | 0.116s run time
onnxscript\_internal\converter_test.py:484: in test_graph_attr_scan
    self.check_run(cumulative_sum, inputs, expected_output)
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\graph_attr.py:19: in cumulative_sum
    zero = op.Constant(value_int=0)
           ^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_loops_break
Stack Traces | 0.154s run time
onnxscript\_internal\converter_test.py:406: in test_loops_break
    self.assertEqual(loops_break.loop_range_cond(x).tolist(), [0.0, 46.0, 92.0])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\loops_break.py:23: in loop_range_cond
    cond = op.Constant(value=make_tensor("condcst", TensorProto.BOOL, [1], [1]))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_attr
Stack Traces | 1.45s run time
onnxscript\_internal\converter_test.py:130: in validate_run
    self.check_run(val.function, val.input, val.output[0])
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\functions\attr_test.py:69: in tensor_attr
    return op.Constant(value=tensor1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset13.py:464: in Constant
    return op(
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined
onnxscript._internal.converter_test.TestConverter::test_getitem
Stack Traces | 5.17s run time
onnxscript\_internal\converter_test.py:130: in validate_run
    self.check_run(val.function, val.input, val.output[0])
onnxscript\_internal\converter_test.py:473: in check_run
    output = onnxfn(*inputs)
             ^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:465: in __call__
    return evaluator.default().eval_function(self, args, kwargs)  # type: ignore[arg-type, return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:308: in eval_function
    result = function.function(*adapted_args, **adapted_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests\models\getitem.py:173: in nested_expr
    r = (A + 1)[0]
         ^^^^^
onnxscript\tensor.py:177: in __add__
    return self._opset.Add(self, other)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\onnx_opset\_impl\opset14.py:81: in Add
    return op(*self._prepare_inputs(schema, A, B))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\values.py:214: in __call__
    return evaluator.default().eval(schema, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:193: in eval
    attributes, closure = self._adapt_attributes(op_signature, attributes)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\_internal\evaluator.py:216: in _adapt_attributes
    use_graph_attribute = self.use_graph_attribute(op_singature)
                                                   ^^^^^^^^^^^^
E   NameError: name 'op_singature' is not defined

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors how operator schemas are handled by replacing direct usage of onnx.defs.OpSchema with a new _schemas.OpSignature abstraction throughout the autocast, converter, and evaluator modules. This change improves modularity and encapsulation when dealing with operator signatures.

Changes:

  • Replaced OpSchema with OpSignature in autocast functions for input type casting
  • Updated converter to pass op_signature instead of op_schema to autocast functions
  • Refactored evaluator methods to be private (_adapt_inputs, _adapt_attributes, _adapt_outputs) and removed the use_graph_attribute method along with its associated conditional logic

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
onnxscript/_internal/autocast.py Updated to use OpSignature instead of OpSchema, including parameter filtering and type constraint access changes
onnxscript/_internal/converter.py Changed to pass op_signature instead of op_schema to autocast functions
onnxscript/_internal/evaluator.py Made adapter methods private, removed use_graph_attribute method, and simplified _adapt_attributes to always use graph attributes
Comments suppressed due to low confidence (1)

onnxscript/_internal/evaluator.py:548

  • The use_graph_attribute method in ORTMixedEvaluator is now dead code since it's no longer called after removing the conditional logic in _adapt_attributes. This method should be removed from the ORTMixedEvaluator class.
    def use_graph_attribute(self, schema: onnx.defs.OpSchema) -> bool:
        return _schema_id(schema) not in self._python_ops

if not expected.is_homogeneous:
args_typevars.append((x, None))
continue
# TODO(justinchuby): Handle is_homogeneous params
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO indicates that the previous is_homogeneous handling was removed but needs to be reimplemented. The old code had logic to handle non-homogeneous variadic parameters. This unfinished work could lead to bugs if non-homogeneous variadic parameters are encountered.

Copilot uses AI. Check for mistakes.
Comment on lines +218 to +220
adapted_attributes[k] = v.function_ir.to_graph_proto()
for pyvar, onnxvar in v.function_ir.outer_scope_variables:
closure[onnxvar.value.name] = v.frame.f_locals[pyvar]
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the use_graph_attribute conditional means that _adapt_attributes now always converts OnnxClosure to graph proto format. This is a behavioral change that affects the ORTMixedEvaluator class, which previously could use the function directly for registered python ops instead of graph proto. This could break existing functionality where python implementations were registered via ORTMixedEvaluator.register().

Suggested change
adapted_attributes[k] = v.function_ir.to_graph_proto()
for pyvar, onnxvar in v.function_ir.outer_scope_variables:
closure[onnxvar.value.name] = v.frame.f_locals[pyvar]
# If the closure captures outer-scope variables, we must materialize
# a graph proto and populate the closure mapping so that evaluators
# can rebind these values when executing the attribute.
if v.function_ir.outer_scope_variables:
adapted_attributes[k] = v.function_ir.to_graph_proto()
for pyvar, onnxvar in v.function_ir.outer_scope_variables:
closure[onnxvar.value.name] = v.frame.f_locals[pyvar]
else:
# For closures without captured outer-scope variables, avoid
# forcing a graph-valued attribute so that evaluators such as
# ORTMixedEvaluator can continue to use the underlying function
# implementation directly (e.g., for registered python ops).
adapted_attributes[k] = v.function_ir

Copilot uses AI. Check for mistakes.
@justinchuby justinchuby marked this pull request as draft January 16, 2026 01:24
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
A closure that can be used to evaluate graph-valued attributes.
"""
use_graph_attribute = self.use_graph_attribute(schema)
use_graph_attribute = self.use_graph_attribute(op_singature)
A closure that can be used to evaluate graph-valued attributes.
"""
use_graph_attribute = self.use_graph_attribute(schema)
use_graph_attribute = self.use_graph_attribute(op_singature)

Check failure

Code scanning / lintrunner

PYLINT/E0602 Error

Undefined variable 'op_singature' (undefined-variable)
See undefined-variable. To disable, use # pylint: disable=undefined-variable
A closure that can be used to evaluate graph-valued attributes.
"""
use_graph_attribute = self.use_graph_attribute(schema)
use_graph_attribute = self.use_graph_attribute(op_singature)

Check failure

Code scanning / lintrunner

RUFF/F821 Error

Undefined name op_singature.
See https://docs.astral.sh/ruff/rules/undefined-name
def adapt_attributes(
self, schema: onnx.defs.OpSchema, attributes: Mapping[str, ExtendedModeValue]
def _adapt_attributes(
self, op_signature, attributes: Mapping[str, ExtendedModeValue]

Check warning

Code scanning / lintrunner

PYLINT/W0613 Warning

Unused argument 'op_signature' (unused-argument)
See unused-argument. To disable, use # pylint: disable=unused-argument
A closure that can be used to evaluate graph-valued attributes.
"""
use_graph_attribute = self.use_graph_attribute(schema)
use_graph_attribute = self.use_graph_attribute(op_singature)

Check warning

Code scanning / lintrunner

PYLINT/W0612 Warning

Unused variable 'use_graph_attribute' (unused-variable)
See unused-variable. To disable, use # pylint: disable=unused-variable
A closure that can be used to evaluate graph-valued attributes.
"""
use_graph_attribute = self.use_graph_attribute(schema)
use_graph_attribute = self.use_graph_attribute(op_singature)

Check warning

Code scanning / lintrunner

RUFF/F841 Warning

Local variable use_graph_attribute is assigned to but never used.
See https://docs.astral.sh/ruff/rules/unused-variable

def use_graph_attribute(self, schema: onnx.defs.OpSchema):

def use_graph_attribute(self, op_signature: _schemas.OpSignature) -> bool:

Check warning

Code scanning / lintrunner

PYLINT/W0613 Warning

Unused argument 'op_signature' (unused-argument)
See unused-argument. To disable, use # pylint: disable=unused-argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants