(self, dim, eps=1e-6, init_count=0, init_mean=0., init_meansq=1.)
Args:
            dim: dimension of the space of points to be standardized
            eps: small constant to add to denominators to prevent division by 0
            init_count, init_mean, init_meansq: initial values for accumulators

        Note:
            if init_count is 0, then init_mean and init_meansq have no effect beyond
            the first call to update(), which will ignore their values and
            replace them with values from a new batch of data.
Args:
            dim: dimension of the space of points to be standardized
            eps: small constant to add to denominators to prevent division by 0
            init_count, init_mean, init_meansq: initial values for accumulators
Args : dim : dimension of the space of points to be standardized eps : small constant to add to denominators to prevent division by 0 init_count init_mean init_meansq : initial values for accumulators
def __init__(self, dim, eps=1e-6, init_count=0, init_mean=0., init_meansq=1.):
        '''
        Args:
            dim: dimension of the space of points to be standardized
            eps: small constant to add to denominators to prevent division by 0
            init_count, init_mean, init_meansq: initial values for accumulators

        Note:
            if init_count is 0, then init_mean and init_meansq have no effect beyond
            the first call to update(), which will ignore their values and
            replace them with values from a new batch of data.
        '''
        self._eps = eps
        self._dim = dim
        with variable_scope(type(self).__name__) as self.__varscope:
            self._count = get_variable('count', np.array(float(init_count)), trainable=False)
            self._mean_1_D = get_variable('mean_1_D', np.full((1, self._dim), init_mean), broadcastable=(True,False), trainable=False)
            self._meansq_1_D = get_variable('meansq_1_D', np.full((1, self._dim), init_meansq), broadcastable=(True,False), trainable=False)
        self._stdev_1_D = tensor.sqrt(tensor.nnet.relu(self._meansq_1_D - tensor.square(self._mean_1_D)))
        # Relu ensures inside is nonnegative. maybe the better choice would have been to
        # add self._eps inside the square root, but I'm keeping things this way to preserve
        # backwards compatibility with existing saved models.

        self.get_mean = self._mean_1_D.get_value
        self.get_stdev = theano.function([], self._stdev_1_D[0,:])
def __init__ ( self , dim , eps = 1e-6 , init_count = 0 , init_mean = 0. , init_meansq = 1. ) : self . _eps = eps self . _dim = dim with variable_scope ( type ( self ) . __name__ ) as self . __varscope : self . _count = get_variable ( 'count' , np . array ( float ( init_count ) ) , trainable = False ) self . _mean_1_D = get_variable ( 'mean_1_D' , np . full ( ( 1 , self . _dim ) , init_mean ) , broadcastable = ( True , False ) , trainable = False ) self . _meansq_1_D = get_variable ( 'meansq_1_D' , np . full ( ( 1 , self . _dim ) , init_meansq ) , broadcastable = ( True , False ) , trainable = False ) self . _stdev_1_D = tensor . sqrt ( tensor . nnet . relu ( self . _meansq_1_D - tensor . square ( self . _mean_1_D ) ) ) # Relu ensures inside is nonnegative. maybe the better choice would have been to # add self._eps inside the square root, but I'm keeping things this way to preserve # backwards compatibility with existing saved models. self . get_mean = self . _mean_1_D . get_value self . get_stdev = theano . function ( [ ] , self . _stdev_1_D [ 0 , : ] )