From 79e75bc5e783b0f1322f98968fd5c951b0799474 Mon Sep 17 00:00:00 2001 From: Li Min <11663212+limin2021@users.noreply.github.com> Date: Wed, 30 Jun 2021 22:02:10 +0800 Subject: [PATCH] remove the initialization of saved_mean and saved_variance for batch_norm op (#33851) --- paddle/fluid/operators/batch_norm_op.cu | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/operators/batch_norm_op.cu b/paddle/fluid/operators/batch_norm_op.cu index 6fc78732b10..1758463141c 100644 --- a/paddle/fluid/operators/batch_norm_op.cu +++ b/paddle/fluid/operators/batch_norm_op.cu @@ -382,8 +382,8 @@ class BatchNormKernel } // Run training mode. - // obtain running mean and running inv var, and see if we need to - // initialize them. + // obtain running mean and running inv var, and there is no need + // to initialize them. auto *mean_out = ctx.Output("MeanOut"); auto *variance_out = ctx.Output("VarianceOut"); @@ -394,10 +394,6 @@ class BatchNormKernel auto *saved_variance = ctx.Output("SavedVariance"); saved_mean->mutable_data>(ctx.GetPlace()); saved_variance->mutable_data>(ctx.GetPlace()); - math::SetConstant> - functor; - functor(dev_ctx, saved_mean, static_cast>(0)); - functor(dev_ctx, saved_variance, static_cast>(0)); if ((N * H * W * D) == 1) { // Only 1 element in normalization dimension, -- GitLab