浏览代码

make validate action private

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

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


)
return action
def validate_action(
def _validate_action(
self, actions: np.ndarray, n_agents: int, name: str
) -> np.ndarray:
"""

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


return
action_spec = self._env_specs[behavior_name].action_spec
num_agents = len(self._env_state[behavior_name][0])
action = action_spec.validate_action(action, num_agents, behavior_name)
action = action_spec._validate_action(action, num_agents, behavior_name)
self._env_actions[behavior_name] = action
def set_action_for_agent(

return
action_spec = self._env_specs[behavior_name].action_spec
num_agents = len(self._env_state[behavior_name][0])
action = action_spec.validate_action(action, num_agents, behavior_name)
action = action_spec._validate_action(action, num_agents, behavior_name)
if behavior_name not in self._env_actions:
self._env_actions[behavior_name] = action_spec.create_empty(num_agents)
try:

正在加载...
取消
保存