Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Remove incomplete conversion function for arange_like.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Evans committed Dec 8, 2020
1 parent 826c053 commit 6541391
Showing 1 changed file with 1 addition and 44 deletions.
45 changes: 1 addition & 44 deletions python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2369,7 +2369,7 @@ def convert_slice(node, **kwargs):
def convert_zeros_like(node, **kwargs):
"""Map MXNet's zeros_like operator attributes to onnx's ConstantOfShape operator.
"""
name, input_nodes, attrs = get_inputs(node, kwargs)
name, input_nodes, _ = get_inputs(node, kwargs)
tensor_value = onnx.helper.make_tensor(name+"_val", onnx.TensorProto.INT32, [1], [0])
node = onnx.helper.make_node(
"ConstantOfShape",
Expand All @@ -2381,46 +2381,3 @@ def convert_zeros_like(node, **kwargs):
return [node]


@mx_op.register("_contrib_arange_like")
def convert_arange_like(node, **kwargs):
"""Map MXNet's arange_like operator attributes to onnx's Range operator.
"""
name, input_nodes, attrs = get_inputs(node, kwargs)

opset_version = kwargs['opset_version']
if opset_version < 11:
raise AttributeError("ONNX opset 11 or greater is required to export this operator")

in_shape = kwargs['in_shape']
axis = attrs.get('axis')
if axis is None:
# output will be same shape as input
raise NotImplementedError("arange_like operator without axis attribute not yet implemented.")
else:
# determine shape of axis
axis_dim = in_shape[int(axis)]

start = attrs.get('start', np.float32(0.))
step = attrs.get('step', np.float32(1.0))
repeat = int(attrs.get('repeat', 1))
if repeat != 1:
raise NotImplementedError("arange_like operator with repeat != 1 not yet implemented.")

nodes = [
create_const_scalar_node(name+"_start", start, kwargs),
create_const_scalar_node(name+"_limit", np.float32(np.inf), kwargs),
create_const_scalar_node(name+"_step", step, kwargs)
]

node = onnx.helper.make_node(
"Range",
[name+"_start", name+"_limit", name+"_step"],
[name],
name=name
)
return [node]





0 comments on commit 6541391

Please sign in to comment.