def sample(self, batch_size):
        """Returns a dict {key: array(batch_size x shapes[key])}
        """
        buffers = {}

        with self.lock:
            assert self.current_size > 0
            for key in self.buffers.keys():
                buffers[key] = self.buffers[key][:self.current_size]

        buffers['o_2'] = buffers['o'][:, 1:, :]
        buffers['ag_2'] = buffers['ag'][:, 1:, :]

        transitions = self.sample_transitions(buffers, batch_size)

        for key in (['r', 'o_2', 'ag_2'] + list(self.buffers.keys())):
            assert key in transitions, "key %s missing from transitions" % key

        return transitions
def sample(self, batch_size):
        """Returns a dict {key: array(batch_size x shapes[key])}
        """
        buffers = {}

        with self.lock:
            assert self.current_size > 0
            for key in self.buffers.keys():
                buffers[key] = self.buffers[key][:self.current_size]

        buffers['o_2'] = buffers['o'][:, 1:, :]
        buffers['ag_2'] = buffers['ag'][:, 1:, :]

        transitions = self.sample_transitions(buffers, batch_size)

        for key in (['r', 'o_2', 'ag_2'] + list(self.buffers.keys())):
            assert key in transitions, "key %s missing from transitions" % key

        return transitions
def sample ( self , batch_size ) : buffers = { } with self . lock : assert self . current_size > 0 for key in self . buffers . keys ( ) : buffers [ key ] = self . buffers [ key ] [ : self . current_size ] buffers [ 'o_2' ] = buffers [ 'o' ] [ : , 1 : , : ] buffers [ 'ag_2' ] = buffers [ 'ag' ] [ : , 1 : , : ] transitions = self . sample_transitions ( buffers , batch_size ) for key in ( [ 'r' , 'o_2' , 'ag_2' ] + list ( self . buffers . keys ( ) ) ) : assert key in transitions , "key %s missing from transitions" % key return transitions
Returns a dict {key: array(batch_size x shapes[key])}
Returns a dict { key : array ( batch_size x shapes [ key ] ) }