浏览代码

Add exception for external brains and array-ify (#1971)

* Add exception for external brains and array-ify

* Fix exception message
/develop-generalizationTraining-TrainerController
Arthur Juliani 6 年前
当前提交
9af9885a
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 10
      gym-unity/gym_unity/envs/unity_env.py

10
gym-unity/gym_unity/envs/unity_env.py


"There can only be one brain in a UnityEnvironment "
"if it is wrapped in a gym."
)
if len(self._env.external_brain_names) <= 0:
raise UnityGymException(
"There are not any external brain in the UnityEnvironment"
)
self.brain_name = self._env.external_brain_names[0]
brain = self._env.brains[self.brain_name]

def _single_step(self, info):
if self.use_visual:
visual_obs = info.visual_observations
if isinstance(visual_obs, list):
visual_obs = np.array(visual_obs)
info.visual_observations[0][0, :, :, :]
visual_obs[0][0, :, :, :]
)
default_observation = self.visual_obs
else:

正在加载...
取消
保存