basic_utils/env_wrapper.py
def update(self, x):
        """
        Update the stored statistics with the new paths.

        Args:
            x: new generated paths
        """
        if self.first_pass:
            self.means = np.mean(x, axis=0)
            self.vars = np.var(x, axis=0)
            self.m = x.shape[0]
            self.first_pass = False
        else:
            n = x.shape[0]
            new_data_var = np.var(x, axis=0)
            new_data_mean = np.mean(x, axis=0)
            new_data_mean_sq = np.square(new_data_mean)
            new_means = ((self.means * self.m) + (new_data_mean * n)) / (self.m + n)
            self.vars = (((self.m * (self.vars + np.square(self.means))) +
                          (n * (new_data_var + new_data_mean_sq))) / (self.m + n) -
                         np.square(new_means))
            self.vars = np.maximum(0.0, self.vars)
            self.means = new_means
            self.m += n

        Update the stored statistics with the new paths.

        Args:
            x: new generated paths
        
Update the stored statistics with the new paths.
Update the stored statistics with the new paths .
def update(self, x):
        if self.first_pass:
            self.means = np.mean(x, axis=0)
            self.vars = np.var(x, axis=0)
            self.m = x.shape[0]
            self.first_pass = False
        else:
            n = x.shape[0]
            new_data_var = np.var(x, axis=0)
            new_data_mean = np.mean(x, axis=0)
            new_data_mean_sq = np.square(new_data_mean)
            new_means = ((self.means * self.m) + (new_data_mean * n)) / (self.m + n)
            self.vars = (((self.m * (self.vars + np.square(self.means))) +
                          (n * (new_data_var + new_data_mean_sq))) / (self.m + n) -
                         np.square(new_means))
            self.vars = np.maximum(0.0, self.vars)
            self.means = new_means
            self.m += n
def update ( self , x ) : if self . first_pass : self . means = np . mean ( x , axis = 0 ) self . vars = np . var ( x , axis = 0 ) self . m = x . shape [ 0 ] self . first_pass = False else : n = x . shape [ 0 ] new_data_var = np . var ( x , axis = 0 ) new_data_mean = np . mean ( x , axis = 0 ) new_data_mean_sq = np . square ( new_data_mean ) new_means = ( ( self . means * self . m ) + ( new_data_mean * n ) ) / ( self . m + n ) self . vars = ( ( ( self . m * ( self . vars + np . square ( self . means ) ) ) + ( n * ( new_data_var + new_data_mean_sq ) ) ) / ( self . m + n ) - np . square ( new_means ) ) self . vars = np . maximum ( 0.0 , self . vars ) self . means = new_means self . m += n
Update the stored statistics with the new paths.
Update the stored statistics with the new paths .
"""
        Update the stored statistics with the new paths.

        Args:
            x: new generated paths
        """
self
x
new generated paths
new generated paths