Skip to content

Commit 0af0707

Browse files
committed
attrs
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
1 parent c84ad91 commit 0af0707

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

onnxscript/_converter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ def translate_slice(slice_expr: ast.Slice) -> tuple[str, str, str]:
705705
steps.append(inputs[2])
706706

707707
if len(starts) > 1:
708-
axis_0_attr = self._make_onnx_attr("axis", 0)
708+
axis_0_attr = ir.AttrInt64("axis", 0)
709709
start_name = self._generate_unique_name(f"{var_name}_start")
710710
self.emit([start_name], "Concat", starts, attrs=[axis_0_attr])
711711

@@ -755,7 +755,7 @@ def translate_slice(slice_expr: ast.Slice) -> tuple[str, str, str]:
755755
last_axis = None
756756
for axis, index_expr in non_scalar_indices:
757757
index_value = self._translate_expr(index_expr)
758-
axis_attr = self._make_onnx_attr("axis", axis)
758+
axis_attr = ir.AttrInt64("axis", axis)
759759
# use Gather to perform indexing
760760
# Assign gathered value to either temporary or final target
761761
if axis != last_axis: # use temporary to store result of Gather
@@ -810,13 +810,13 @@ def _translate_binary_op_expr(self, node: ast.BinOp):
810810
# attribute fmod=1 is added in that case.
811811
cst = self._eval_constant_expr(node.right)
812812
if isinstance(cst, float):
813-
attr = [self._make_onnx_attr("fmod", 1)]
813+
attr = [ir.AttrInt64("fmod", 1)]
814814

815-
op = values.Op(self._default_opset, _PRIMOP_MAP[op])
815+
onnx_op = _PRIMOP_MAP[op]
816816
left, right = self._cast_like_binary_expression(
817-
op, self._translate_expr(node.left), self._translate_expr(node.right)
817+
onnx_op, self._translate_expr(node.left), self._translate_expr(node.right)
818818
)
819-
return op, [left, right], attr
819+
return onnx_op, [left, right], attr
820820

821821
def _translate_unary_op_expr(self, node):
822822
op = type(node.op)

0 commit comments

Comments
 (0)