Skip to content

Commit 46a6cac

Browse files
authored
fix batch norm. test=develop (#15597)
1 parent 943d972 commit 46a6cac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

paddle/fluid/operators/batch_norm_op.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,10 @@ class BatchNormGradMaker : public framework::SingleGradOpDescMaker {
589589
op->SetInput("SavedVariance", Output("SavedVariance"));
590590

591591
// used when setting use_global_stats True during training
592-
op->SetInput("Mean", Output("MeanOut"));
593-
op->SetInput("Variance", Output("VarianceOut"));
592+
if (boost::get<bool>(GetAttr("use_global_stats"))) {
593+
op->SetInput("Mean", Output("MeanOut"));
594+
op->SetInput("Variance", Output("VarianceOut"));
595+
}
594596

595597
op->SetAttrMap(Attrs());
596598

0 commit comments

Comments
 (0)