Example #1
0
 def preprocess_state(self, state, append=True):
     '''Transforms the raw state into format that is fed into the network'''
     state = util.transform_image(state)
     # append when state is first seen when acting in policy_util, don't append elsewhere in memory
     self.preprocess_append(state, append)
     processed_state = np.stack(self.state_buffer, axis=-1).astype(np.float16)
     assert processed_state.shape == self.body.state_dim
     return processed_state
Example #2
0
 def preprocess_state(self, state, append=True):
     '''Transforms the raw state into format that is fed into the network'''
     state = util.transform_image(state)
     # append when state is first seen when acting in policy_util, don't append elsewhere in memory
     if append:
         assert id(state) != id(self.state_buffer[-1]), 'Do not append to buffer other than during action'
         self.state_buffer.append(state)
     processed_state = np.stack(self.state_buffer, axis=-1).astype(np.float16)
     assert processed_state.shape == self.body.state_dim
     return processed_state
Example #3
0
 def observation(self, frame):
     frame = util.transform_image(frame, method='openai')
     frame = np.expand_dims(frame, -1)
     frame = np.swapaxes(frame, 2, 0)
     return frame
Example #4
0
 def observation(self, frame):
     frame = util.transform_image(frame, method='openai')
     frame = np.transpose(frame)  # reverses all axes
     frame = np.expand_dims(frame, 0)
     return frame