浏览代码

make is_discrete/is_continuous strict

/develop/action-spec-gym
Andrew Cohen 4 年前
当前提交
0e032b0a
共有 2 个文件被更改,包括 9 次插入3 次删除
  1. 8
      gym-unity/gym_unity/envs/__init__.py
  2. 4
      ml-agents-envs/mlagents_envs/base_env.py

8
gym-unity/gym_unity/envs/__init__.py


else:
self._action_space = spaces.MultiDiscrete(branches)
else:
elif self.group_spec.action_spec.is_continuous():
else:
raise UnityGymException(
"The gym wrapper does not provide explicit support for both discrete "
"and continuous actions."
)
# Set observations space
list_spaces: List[gym.Space] = []

4
ml-agents-envs/mlagents_envs/base_env.py


"""
Returns true if this Behavior uses discrete actions
"""
return self.discrete_size > 0
return self.discrete_size > 0 and self.continuous_size == 0
# For backwards compatibility
def is_continuous(self) -> bool:

return self.continuous_size > 0
return self.discrete_size == 0 and self.continuous_size > 0
@property
def discrete_branches(self) -> Tuple[int, ...]:

正在加载...
取消
保存