浏览代码

handle null action outputs (#2988)

/release-0.12.0
GitHub 5 年前
当前提交
d6f69c1f
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 7
      ml-agents-envs/mlagents/envs/env_manager.py
  2. 2
      ml-agents/mlagents/trainers/trainer_controller.py

7
ml-agents-envs/mlagents/envs/env_manager.py


current_all_brain_info: AllBrainInfo
brain_name_to_action_info: Optional[Dict[str, ActionInfo]]
def has_actions_for_brain(self, brain_name: str) -> bool:
return (
self.brain_name_to_action_info is not None
and brain_name in self.brain_name_to_action_info
and self.brain_name_to_action_info[brain_name].outputs is not None
)
class EnvManager(ABC):
def __init__(self):

2
ml-agents/mlagents/trainers/trainer_controller.py


for brain_name, trainer in self.trainers.items():
if brain_name in self.trainer_metrics:
self.trainer_metrics[brain_name].add_delta_step(delta_time_step)
if brain_name in step_info.brain_name_to_action_info:
if step_info.has_actions_for_brain(brain_name):
trainer.add_experiences(
step_info.previous_all_brain_info[brain_name],
step_info.current_all_brain_info[brain_name],

正在加载...
取消
保存