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

Commit

Permalink
ONNX export: logsoftmax
Browse files Browse the repository at this point in the history
  • Loading branch information
vandanavk committed Dec 17, 2018
1 parent a8261c4 commit e155725
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,3 +1655,23 @@ def convert_size(node, **kwargs):
and return the created node.
"""
return create_basic_op_node('Size', node, kwargs)


@mx_op.register("log_softmax")
def convert_logsoftmax(node, **kwargs):
"""Map MXNet's log_softmax operator attributes to onnx's LogSoftMax operator
and return the created node.
"""
name, input_nodes, attrs = get_inputs(node, kwargs)

# Converting to float32
axis = int(attrs.get("axis", 1))

node = onnx.helper.make_node(
'LogSoftmax',
input_nodes,
[name],
axis=abs(axis),
name=name
)
return [node]

0 comments on commit e155725

Please sign in to comment.