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

Commit

Permalink
ONNX export: Gather
Browse files Browse the repository at this point in the history
  • Loading branch information
vandanavk committed Jan 2, 2020
1 parent 06aec8a commit ed85248
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
18 changes: 18 additions & 0 deletions python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2080,3 +2080,21 @@ def convert_topk(node, **kwargs):
)

return [topk_node]


@mx_op.register("take")
def convert_take(node, **kwargs):
"""Map MXNet's Take operator attributes to onnx's Gather operator.
"""
name, input_nodes, attrs = get_inputs(node, kwargs)

axis = int(attrs.get('axis', 0))

node = onnx.helper.make_node(
"Gather",
input_nodes,
[name],
axis=axis,
name=name,
)
return [node]
6 changes: 3 additions & 3 deletions tests/python-pytest/onnx/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
'test_softplus',
'test_reduce_',
'test_split_equal',
'test_top_k'
'test_top_k',
'test_gather'
],
'import': ['test_gather',
'test_softsign',
'import': ['test_softsign',
'test_mean',
'test_averagepool_1d',
'test_averagepool_2d_pads_count_include_pad',
Expand Down

0 comments on commit ed85248

Please sign in to comment.