Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[ONNX export] Fixing spatial export for batchnorm (#17711) (#18846)
Browse files Browse the repository at this point in the history
* 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 <vinitras@gmail.com>
  • Loading branch information
ChaiBapchya and vinitra authored Aug 3, 2020
1 parent 73d3a7b commit 5db8dee
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 5db8dee

Please sign in to comment.