import tensorflow as tf


            # BN when training
            update = 1.0 - decay
            update_mu = mu.assign_sub(update * (mu - batch_mean))
            update_sigma = sigma.assign_sub(update * (sigma - batch_var))
            tf.add_to_collection(tf.GraphKeys.UPDATE_OPS, update_mu)
            tf.add_to_collection(tf.GraphKeys.UPDATE_OPS, update_sigma)

            mean, var = tf.cond(self.train_flag, lambda: (batch_mean, batch_var), lambda: (mu, sigma))
            bn = tf.nn.batch_normalization(x, mean, var, beta, gamma, 1e-5)

            tf.add_to_collection('debug_layers', bn)

            return bn
