You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/06/26 06:39:42 UTC

[GitHub] anirudhacharya 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.

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

 ##########
 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:
   if ``attrs`` does not contain 'epsilon', then it should be defaulted to 1e-5. ([reference](https://github.com/onnx/onnx/blob/master/docs/Operators.md#attributes-3))

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services