def sample(self, batch_size):
buffers = {}<EOL>with self.lock:<EOL><INDENT>assert self.current_size > <NUM_LIT:0><EOL>for key in self.buffers.keys():<EOL><INDENT>buffers[key] = self.buffers[key][:self.current_size]<EOL><DEDENT><DEDENT>buffers['<STR_LIT>'] = buffers['<STR_LIT:o>'][:, <NUM_LIT:1>:, :]<EOL>buffers['<STR_LIT>'] = buffers['<STR_LIT>'][:, <NUM_LIT:1>:, :]<EOL>transitions = self.sample_transitions(buffers, batch_size)<EOL>for key in (['<STR_LIT:r>', '<STR_LIT>', '<STR_LIT>'] + list(self.buffers.keys())):<EOL><INDENT>assert key in transitions, "<STR_LIT>" % key<EOL><DEDENT>return transitions<EOL>
Returns a dict {key: array(batch_size x shapes[key])}