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

Method push

examples/reinforcement_learning/tutorial_TD3.py:109–113  ·  view source on GitHub ↗
(self, state, action, reward, next_state, done)

Source from the content-addressed store, hash-verified

107 self.position = 0
108
109 def push(self, state, action, reward, next_state, done):
110 if len(self.buffer) < self.capacity:
111 self.buffer.append(None)
112 self.buffer[self.position] = (state, action, reward, next_state, done)
113 self.position = int((self.position + 1) % self.capacity) # as a ring buffer
114
115 def sample(self, batch_size):
116 batch = random.sample(self.buffer, batch_size)

Callers 1

tutorial_TD3.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected