def get_action(self, obs): if obs.shape[-1] != self.image_size: obs = center_crop_image(obs, self.image_size) obs = np.expand_dims(np.array(obs), axis=0) feature = self.encoder(obs) action, _ = self.actor(feature) action = action.numpy()[0] return action
def eval_action(self, obs): if obs.shape[-1] != self.image_size: obs = center_crop_image(obs, self.image_size) obs = np.expand_dims(np.array(obs), axis=0) feature = self.encoder(obs) action = self.actor(feature).numpy()[0] action = np.clip(action, -1, 1) return action
def get_action(self, obs): if obs.shape[-1] != self.image_size: obs = center_crop_image(obs, self.image_size) obs = np.expand_dims(np.array(obs), axis=0) noise = np.random.normal(loc=0, scale=self.actor_noise, size=self.action_dim) feature = self.encoder(obs) action = self.actor(feature).numpy()[0] + noise action = np.clip(action, -1, 1) return action