sandeep-krishnamurthy commented on a change in pull request #12625: [MXNET-979] 
Add fix_beta support in BatchNorm
URL: https://github.com/apache/incubator-mxnet/pull/12625#discussion_r222796261
 
 

 ##########
 File path: src/operator/nn/batch_norm.cc
 ##########
 @@ -164,25 +164,65 @@ void BatchNormForwardImpl(mshadow::Stream<cpu> *,
 
     // note that var is still invstd
     if (!param_.fix_gamma) {
-      if (IsBNWriting(req[batchnorm::kData])) {
-        ForEachFast(inputData, outputData, channel,
-                    [thisWeight, thisBias, thisMean, thisInvstd](const DType 
*in_data,
-                                                                 DType 
*out_data) {
-                      *out_data = static_cast<DType>(
-                        ((*in_data - thisMean) * thisInvstd) * thisWeight + 
thisBias);
-                    });
+      if (!param_.fix_beta) {
 
 Review comment:
   It is basically 2 cases based on fix_gamma. fix_beta cases are collated 
within it.
   This has more readability with flags on the cases. Suggestions?

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


With regards,
Apache Git Services

Reply via email to