Skip to content

Unsupported slice indexes to iter a graph #24

Closed
@Johansmm

Description

@Johansmm

Based on microsoft/onnxscript#2302

Code to reproduce the error:

import onnx
import onnx_ir

model = onnx.parser.parse_model(
"""<ir_version: 10, opset_import: [ "" : 17]>
     agraph (float[N] x) => (float[N] z) {
         y = Sigmoid(x)
         z = Mul(y, y)  
     }""")
ir_model = onnx_ir.from_proto(model)
ir_model.graph[0:]

Error logs

Errors when executing ir_model.graph[0:]:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "onnx_ir\_core.py", line 2232, in __getitem__
    return self._nodes[index]
           ~~~~~~~~~~~^^^^^^^
  File "onnx_ir\_linked_list.py", line 144, in __getitem__
    if index >= self._length or index < -self._length:
       ^^^^^^^^^^^^^^^^^^^^^
TypeError: '>=' not supported between instances of 'slice' and 'int'

Metadata

Metadata

Assignees

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