Skip to content

Commit

Permalink
[ONNX export] Fixing spatial export for batchnorm (apache#17711)
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
  • Loading branch information
vinitra authored and Vladimir Cherepanov committed Apr 7, 2020
1 parent bc1decd commit 605e45e
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 605e45e

Please sign in to comment.