anirudhacharya commented on a change in pull request #11140: [MXNET-344] 
[ONNX-MXNet] Add new Operator Translations for ONNX import module
URL: https://github.com/apache/incubator-mxnet/pull/11140#discussion_r194824905
 
 

 ##########
 File path: python/mxnet/contrib/onnx/_import/op_translations.py
 ##########
 @@ -417,6 +458,16 @@ def flatten(attrs, inputs, proto_obj):
     new_attrs = translation_utils._remove_attributes(attrs, ['axis'])
     return 'Flatten', new_attrs, inputs
 
+def clip(attrs, inputs, proto_obj):
+    """Clips (limits) the values in an array."""
+    new_attrs = translation_utils._fix_attribute_names(attrs, {'min' : 'a_min',
+                                                               'max' : 
'a_max'})
+    if 'a_max' not in new_attrs:
+        new_attrs = translation_utils._add_extra_attributes(new_attrs, 
{'a_max' : np.inf})
+    if 'a_min' not in new_attrs:
+        new_attrs = translation_utils._add_extra_attributes(new_attrs, 
{'a_min' : -np.inf})
 
 Review comment:
   np.inf can be used as float - 
https://stackoverflow.com/questions/42315541/difference-between-np-inf-and-floatinf

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to