浏览代码

Fix issue with team_actions

/develop/centralizedcritic/counterfact
Ervin Teng 4 年前
当前提交
3e481f7d
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 1
      ml-agents/mlagents/trainers/ppo/optimizer_torch.py
  2. 8
      ml-agents/mlagents/trainers/torch/agent_action.py

1
ml-agents/mlagents/trainers/ppo/optimizer_torch.py


act_masks = ModelUtils.list_to_tensor(batch["action_mask"])
actions = AgentAction.from_dict(batch)
team_actions = AgentAction.from_team_dict(batch)
memories = [
ModelUtils.list_to_tensor(batch["memory"][i])

8
ml-agents/mlagents/trainers/torch/agent_action.py


agent_buffer_field: AgentBuffer.AgentBufferField,
dtype: torch.dtype = torch.float32,
) -> List[torch.Tensor]:
"""
Pad actions and convert to tensor. Note that data is padded by 0's, not NaNs
as the observations are.
"""
action_shape = _action.shape
action_shape = _action[0].shape
break
# If there were no critic obs at all
if action_shape is None:

map(
lambda x: ModelUtils.list_to_tensor(x, dtype=dtype),
itertools.zip_longest(
*agent_buffer_field, fillvalue=np.full(action_shape, np.nan)
*agent_buffer_field, fillvalue=np.full(action_shape, 0)
),
)
)

正在加载...
取消
保存