Skip to content

Ensure empty ints attributes are created correctly #2496

@justinchuby

Description

@justinchuby

Changes due to onnx/ir-py#148

_______________ ShapeOptimizationTest.test_shape_optimization_5 ________________
[gw0] darwin -- Python 3.11.9 /Users/runner/work/onnxscript/onnxscript/.nox/test_onnx_ir_git/bin/python
.nox/test_onnx_ir_git/lib/python3.11/site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/rewriter/ort_fusions/shape_optimization_test.py:58: in test_shape_optimization
    count = shape_optimization.rules.apply_to_model(model)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/rewriter/_rewrite_rule.py:768: in apply_to_model
    count = self._apply_to_graph_or_function(
onnxscript/rewriter/_rewrite_rule.py:659: in _apply_to_graph_or_function
    delta = rule.try_rewrite(
onnxscript/rewriter/_rewrite_rule.py:323: in try_rewrite
    replacement_subgraph = self._replacement_pattern.get_replacement(match)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/rewriter/_rewrite_rule.py:219: in get_replacement
    new_outputs = self._function(context, **match.bindings)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/rewriter/ort_fusions/shape_optimization.py:58: in rewrite
    return op.Constant(value_ints=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/ir/_tape.py:23: in <lambda>
    return lambda *args, **kwargs: self._make_node(op_type, args, kwargs)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/ir/_tape.py:36: in _make_node
    value = super().op(
.nox/test_onnx_ir_git/lib/python3.11/site-packages/onnx_ir/_tape.py:92: in op
    attrs = _convenience.convert_attributes(attributes)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/test_onnx_ir_git/lib/python3.11/site-packages/onnx_ir/_convenience/__init__.py:270: in convert_attributes
    attributes.append(convert_attribute(name, attr))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/test_onnx_ir_git/lib/python3.11/site-packages/onnx_ir/_convenience/__init__.py:148: in convert_attribute
    attr_type = _infer_attribute_type(attr)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/test_onnx_ir_git/lib/python3.11/site-packages/onnx_ir/_convenience/__init__.py:73: in _infer_attribute_type
    raise ValueError(
E   ValueError: Cannot infer type of empty sequence. Please create an Attr with an explicit type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions