import tensorflow as tf

            mu,var = tf.nn.moments(t,axes=[0])
            std = tf.sqrt(var+self.epsilon)
            return [tf.assign(self.g,1/std),tf.assign(self.b,-1.*mu/std)]

        require_init = tf.reduce_any(tf.is_nan(self.g))
        init_ops = tf.cond(require_init,_init,lambda : [self.g,self.b])

        with tf.control_dependencies(init_ops):
            w = tf.expand_dims(self.g,axis=0) * tf.nn.l2_normalize(self.v,axis=0)
            return tf.matmul(input_var,w)+self.b

    def get_variables(self):
        #TODO: self.v should be l2-normalized or not? / currently not.
        return {'v':self.v,'b':self.b,'g':self.g}
