MCPcopy
hub / github.com/tensorlayer/TensorLayer / push

Method push

examples/reinforcement_learning/tutorial_SAC.py:97–101  ·  view source on GitHub ↗
(self, state, action, reward, next_state, done)

Source from the content-addressed store, hash-verified

95 self.position = 0
96
97 def push(self, state, action, reward, next_state, done):
98 if len(self.buffer) < self.capacity:
99 self.buffer.append(None)
100 self.buffer[self.position] = (state, action, reward, next_state, done)
101 self.position = int((self.position + 1) % self.capacity) # as a ring buffer
102
103 def sample(self, BATCH_SIZE):
104 batch = random.sample(self.buffer, BATCH_SIZE)

Callers 1

tutorial_SAC.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected