Skip to content

Commit 6a58482

Browse files
committed
Fixes for when attr type can be ambiguous for empty lists
Signed-off-by: Justin Chu <[email protected]>
1 parent ae4c668 commit 6a58482

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)