anirudhacharya commented on a change in pull request #14942: ONNX export: Slice
op - Handle None value for ends
URL: https://github.com/apache/incubator-mxnet/pull/14942#discussion_r362656297
##########
File path: python/mxnet/contrib/onnx/onnx2mx/_op_translations.py
##########
@@ -499,15 +499,19 @@ def split(attrs, inputs, proto_obj):
def _slice(attrs, inputs, proto_obj):
"""Returns a slice of the input tensor along multiple axes."""
+ input_tensor_data = proto_obj.model_metadata.get('input_tensor_data')[0]
+ input_shape = input_tensor_data[1]
new_attrs = translation_utils._fix_attribute_names(attrs,
{'axes' : 'axis',
'ends' : 'end',
'starts' : 'begin'})
# onnx slice provides slicing on multiple axis. Adding multiple slice_axis
operator
# for multiple axes from mxnet
begin = new_attrs.get('begin')
- end = new_attrs.get('end')
+ end = list(new_attrs.get('end'))
Review comment:
if `end` does not exist in new_attrs, converting it to a list will throw
NoneType error. ( unless onnx spec requires ends as a required attribute?)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services