wkcn commented on a change in pull request #14542: Support SyncBatchNorm5D
URL: https://github.com/apache/incubator-mxnet/pull/14542#discussion_r269808533
##########
File path: src/operator/contrib/sync_batch_norm-inl.h
##########
@@ -275,14 +275,17 @@ class SyncBatchNorm : public Operator {
static_cast<real_t>(in_data[syncbatchnorm::kData].shape_.Size());
Tensor<xpu, 4> data;
Tensor<xpu, 4> out;
- if (in_data[syncbatchnorm::kData].ndim() == 2) {
+ if (in_data[syncbatchnorm::kData].ndim() == 4) {
Review comment:
Yes. In 3DConvNet, the input dimension of BatchNorm is 5 (NCDHW). However,
SyncBatchNorm only supported 2D or 4D inputs before, and BatchNorm supports all
dimensions. So I modified the code of SyncBatchNorm to support all dimensions
of inputs.
I inverse the branches of if-else ndim==4. When ndim is 4, we get the TBlob
directly, otherwise we reshape the TBlob to dshape (N,C,1,D*H*W).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services