def store_episode(self, episode_batch, update_stats=True):
        """
        episode_batch: array of batch_size x (T or T+1) x dim_key
                       'o' is of size T+1, others are of size T
        """

        self.buffer.store_episode(episode_batch)

        if update_stats:
            # add transitions to normalizer
            episode_batch['o_2'] = episode_batch['o'][:, 1:, :]
            episode_batch['ag_2'] = episode_batch['ag'][:, 1:, :]
            num_normalizing_transitions = transitions_in_episode_batch(episode_batch)
            transitions = self.sample_transitions(episode_batch, num_normalizing_transitions)

            o, g, ag = transitions['o'], transitions['g'], transitions['ag']
            transitions['o'], transitions['g'] = self._preprocess_og(o, ag, g)
            # No need to preprocess the o_2 and g_2 since this is only used for stats

            self.o_stats.update(transitions['o'])
            self.g_stats.update(transitions['g'])

            self.o_stats.recompute_stats()
            self.g_stats.recompute_stats()
def store_episode(self, episode_batch, update_stats=True):
        """
        episode_batch: array of batch_size x (T or T+1) x dim_key
                       'o' is of size T+1, others are of size T
        """

        self.buffer.store_episode(episode_batch)

        if update_stats:
            # add transitions to normalizer
            episode_batch['o_2'] = episode_batch['o'][:, 1:, :]
            episode_batch['ag_2'] = episode_batch['ag'][:, 1:, :]
            num_normalizing_transitions = transitions_in_episode_batch(episode_batch)
            transitions = self.sample_transitions(episode_batch, num_normalizing_transitions)

            o, g, ag = transitions['o'], transitions['g'], transitions['ag']
            transitions['o'], transitions['g'] = self._preprocess_og(o, ag, g)
            # No need to preprocess the o_2 and g_2 since this is only used for stats

            self.o_stats.update(transitions['o'])
            self.g_stats.update(transitions['g'])

            self.o_stats.recompute_stats()
            self.g_stats.recompute_stats()
def store_episode ( self , episode_batch , update_stats = True ) : self . buffer . store_episode ( episode_batch ) if update_stats : # add transitions to normalizer episode_batch [ 'o_2' ] = episode_batch [ 'o' ] [ : , 1 : , : ] episode_batch [ 'ag_2' ] = episode_batch [ 'ag' ] [ : , 1 : , : ] num_normalizing_transitions = transitions_in_episode_batch ( episode_batch ) transitions = self . sample_transitions ( episode_batch , num_normalizing_transitions ) o , g , ag = transitions [ 'o' ] , transitions [ 'g' ] , transitions [ 'ag' ] transitions [ 'o' ] , transitions [ 'g' ] = self . _preprocess_og ( o , ag , g ) # No need to preprocess the o_2 and g_2 since this is only used for stats self . o_stats . update ( transitions [ 'o' ] ) self . g_stats . update ( transitions [ 'g' ] ) self . o_stats . recompute_stats ( ) self . g_stats . recompute_stats ( )
episode_batch: array of batch_size x (T or T+1) x dim_key
                       'o' is of size T+1, others are of size T
episode_batch : array of batch_size x ( T or T + 1 ) x dim_key o is of size T + 1 others are of size T