MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / sample_batch

Method sample_batch

pytorch/rl_trader.py:49–55  ·  view source on GitHub ↗
(self, batch_size=32)

Source from the content-addressed store, hash-verified

47 self.size = min(self.size+1, self.max_size)
48
49 def sample_batch(self, batch_size=32):
50 idxs = np.random.randint(0, self.size, size=batch_size)
51 return dict(s=self.obs1_buf[idxs],
52 s2=self.obs2_buf[idxs],
53 a=self.acts_buf[idxs],
54 r=self.rews_buf[idxs],
55 d=self.done_buf[idxs])
56
57
58

Callers 1

replayMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected