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

Commit

Permalink
adding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Roshrini committed Sep 27, 2018
1 parent ddf18d9 commit d2c0513
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,10 @@ def convert_cast(node, **kwargs):
proc_nodes = kwargs["proc_nodes"]
inputs = node["inputs"]
dtype = node["attrs"]["dtype"]

# dtype can be mapped only with types from TensorProto
# float32 is mapped to float and float64 to double in onnx
# following tensorproto mapping https://github.com/onnx/onnx/blob/master/onnx/mapping.py
if dtype == 'float32':
dtype = 'float'
elif dtype == 'float64':
Expand Down
2 changes: 2 additions & 0 deletions python/mxnet/contrib/onnx/onnx2mx/_op_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def argmax(attrs, inputs, proto_obj):
axis = attrs.get('axis', 0)
keepdims = attrs.get('keepdims', 1)
argmax_op = symbol.argmax(inputs[0], axis=axis, keepdims=keepdims)
# onnx argmax operator always expects int64 as output type
cast_attrs = {'dtype': 'int64'}
return 'cast', cast_attrs, argmax_op

Expand All @@ -129,6 +130,7 @@ def argmin(attrs, inputs, proto_obj):
axis = attrs.get('axis', 0)
keepdims = attrs.get('keepdims', 1)
argmin_op = symbol.argmin(inputs[0], axis=axis, keepdims=keepdims)
# onnx argmax operator always expects int64 as output type
cast_attrs = {'dtype': 'int64'}
return 'cast', cast_attrs, argmin_op

Expand Down

0 comments on commit d2c0513

Please sign in to comment.