浏览代码

Fixing develop after merging action masking (#1114)

Ran into problems due to inacurate merging of develop into the branch
/develop-generalizationTraining-TrainerController
GitHub 6 年前
当前提交
9ba493ef
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 5
      python/unityagents/environment.py
  2. 4
      unity-environment/Assets/ML-Agents/Scripts/Batcher.cs

5
python/unityagents/environment.py


mask_actions = np.ones((len(agent_info_list), total_num_actions))
for agent_index, agent_info in enumerate(agent_info_list):
if agent_info.action_mask is not None:
mask_actions[agent_index, :] = [
0 if agent_info.action_mask[k] else 1 for k in range(total_num_actions)]
if len(agent_info.action_mask) == total_num_actions:
mask_actions[agent_index, :] = [
0 if agent_info.action_mask[k] else 1 for k in range(total_num_actions)]
if any([np.isnan(x.reward) for x in agent_info_list]):
logger.warning("An agent had a NaN reward for brain "+b)
if any([np.isnan(x.stacked_vector_observation).any() for x in agent_info_list]):

4
unity-environment/Assets/ML-Agents/Scripts/Batcher.cs


{
agentInfoProto.Memories.Add(info.memories);
}
if (info.actionMasks != null)
{
agentInfoProto.ActionMask.AddRange(info.actionMasks);
}
foreach (Texture2D obs in info.visualObservations)
{
agentInfoProto.VisualObservations.Add(

正在加载...
取消
保存