Closed
Description
Code to reproduce the error:
import onnx
from onnxscript import 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 = 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 "onnxscript\ir\_core.py", line 2232, in __getitem__
return self._nodes[index]
~~~~~~~~~~~^^^^^^^
File "onnxscript\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
Activity
justinchuby commentedon May 13, 2025
Contributions welcomed! In the meantime, consider
nodes = tuple(model.graph)
Then take slices on the nodes
[IR] introduce slice support (microsoft#2302)
[IR] introduce slice support (microsoft#2302)
[IR] introduce slice support (microsoft#2302)
[IR] introduce slice support (microsoft#2302)
[IR] introduce slice support (microsoft#2302)
[IR] introduce slice support on graph (microsoft#2307)