This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to branch v1.x
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/v1.x by this push:
new 5db8dee [ONNX export] Fixing spatial export for batchnorm (#17711)
(#18846)
5db8dee is described below
commit 5db8dee9be5e6e29f9addb5f6c950fe8971d487f
Author: Chaitanya Prakash Bapat <[email protected]>
AuthorDate: Mon Aug 3 12:05:20 2020 -0700
[ONNX export] Fixing spatial export for batchnorm (#17711) (#18846)
* fixing spatial export for batchnorm
* retrigger CI
* fixing broken pylint
* retrigger build
* deprecating spatial attribute in exporter so default behavior of
spatial=1 is conveyed
Co-authored-by: Vinitra Swamy <[email protected]>
---
python/mxnet/contrib/onnx/mx2onnx/_op_translations.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
b/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
index bfd905c..b1ab40e 100644
--- a/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
+++ b/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
@@ -349,10 +349,11 @@ def convert_batchnorm(node, **kwargs):
[name],
name=name,
epsilon=eps,
- momentum=momentum,
- # MXNet computes mean and variance per feature for batchnorm
- # Default for onnx is across all spatial features. So disabling the
parameter.
- spatial=0
+ momentum=momentum
+ # MXNet computes mean and variance per channel for batchnorm.
+ # Default for onnx is across all spatial features. Relying on default
+ # ONNX behavior of spatial=1 for ONNX opset 8 and below. As the spatial
+ # attribute is deprecated in opset 9 and above, not explicitly
encoding it.
)
return [bn_node]