From c27f406cb5afed1818723a8e5d9364fd81899f09 Mon Sep 17 00:00:00 2001 From: linmin Date: Mon, 25 Apr 2016 10:44:45 +0800 Subject: [PATCH 1/2] init moving_var with 1 --- python/mxnet/initializer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/mxnet/initializer.py b/python/mxnet/initializer.py index 990dbbf1..e5eaea99 100644 --- a/python/mxnet/initializer.py +++ b/python/mxnet/initializer.py @@ -40,7 +40,7 @@ def __call__(self, name, arr): elif name.endswith("moving_mean"): self._init_zero(name, arr) elif name.endswith("moving_var"): - self._init_zero(name, arr) + self._init_one(name, arr) elif name.endswith("moving_inv_var"): self._init_zero(name, arr) elif name.endswith("moving_avg"): @@ -62,6 +62,9 @@ def _init_bilinear(self, _, arr): def _init_zero(self, _, arr): arr[:] = 0.0 + def _init_one(self, _, arr): + arr[:] = 1.0 + def _init_bias(self, _, arr): arr[:] = 0.0 From 89d81ad240ad8258181326adb01e7bf9147cc48f Mon Sep 17 00:00:00 2001 From: linmin Date: Mon, 25 Apr 2016 11:06:38 +0800 Subject: [PATCH 2/2] cudnn's exponetialAverageFactor is 1 - momentum --- src/operator/cudnn_batch_norm-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operator/cudnn_batch_norm-inl.h b/src/operator/cudnn_batch_norm-inl.h index cc94b363..fc3bd86d 100644 --- a/src/operator/cudnn_batch_norm-inl.h +++ b/src/operator/cudnn_batch_norm-inl.h @@ -115,7 +115,7 @@ class CuDNNBatchNormOp : public Operator { mean_desc_, gamma.dptr_, beta.dptr_, - param_.momentum, + 1 - param_.momentum, moving_mean.dptr_, moving_inv_var.dptr_, param_.eps,