mkolod commented on a change in pull request #11380: Add ability to query cuDNN 
BatchNorm min. epsilon. Allow ONNX importer to use cuDNN BN if chosen eps >= 
cuDNN min. eps.
URL: https://github.com/apache/incubator-mxnet/pull/11380#discussion_r198237229
 
 

 ##########
 File path: python/mxnet/contrib/onnx/onnx2mx/_op_translations.py
 ##########
 @@ -209,7 +211,9 @@ def batch_norm(attrs, inputs, proto_obj):
                                                                'is_test': 
'fix_gamma'})
     new_attrs = translation_utils._remove_attributes(new_attrs,
                                                      ['spatial', 
'consumed_inputs'])
-    new_attrs = translation_utils._add_extra_attributes(new_attrs, 
{'cudnn_off': 1})
+    cudnn_eps = get_cudnn_epsilon()
+    cudnn_off = 0 if not math.isnan(cudnn_eps) and attrs['epsilon'] >= 
cudnn_eps else 1
 
 Review comment:
   Good point!

----------------------------------------------------------------
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