Skip to content

Commit fce51b6

Browse files
authored
Fixes for when attr type can be ambiguous for empty lists (#2505)
Fixes according to onnx/ir-py#162 Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
1 parent 2838e37 commit fce51b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

onnxscript/optimizer/_constant_folding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def gather(node: ir.Node, op, state: OptimizerState) -> ReturnValue:
388388
if output is not None:
389389
state.set_sym_value(output, ir.Shape(gathered))
390390
if all(isinstance(d, int) for d in gathered):
391-
return op.Constant(value_ints=gathered)
391+
return op.Constant(value_ints=ir.AttrInt64s("value_ints", gathered))
392392
return None
393393

394394

@@ -466,7 +466,7 @@ def shape(node: ir.Node, op, state: OptimizerState) -> ReturnValue:
466466
if output is not None:
467467
state.set_sym_value(output, ir.Shape(shape_slice))
468468
if all(isinstance(d, int) for d in shape_slice):
469-
return op.Constant(value_ints=list(shape_slice))
469+
return op.Constant(value_ints=ir.AttrInt64s("value_ints", list(shape_slice)))
470470
return None
471471

472472

0 commit comments

Comments
 (0)