浏览代码

Properly feed in None rather than empty arrays

/develop/skipcritic
Ervin Teng 4 年前
当前提交
4158629e
共有 2 个文件被更改,包括 6 次插入4 次删除
  1. 8
      ml-agents/mlagents/trainers/policy/torch_policy.py
  2. 2
      ml-agents/mlagents/trainers/torch/components/bc/module.py

8
ml-agents/mlagents/trainers/policy/torch_policy.py


:return: Tuple of actions, actions clipped to -1, 1, log probabilities (dependent on all_log_probs),
entropies, and output memories, all as Torch Tensors.
"""
if memories is None or memories.numel() == 0:
if memories is None:
dists, memories = self.actor_critic.get_dists(
vec_obs, vis_obs, masks, memories, seq_len
)

vis_obs = [
torch.as_tensor(vis_ob) for vis_ob in vec_vis_obs.visual_observations
]
memories = torch.as_tensor(self.retrieve_memories(global_agent_ids)).unsqueeze(
0
memories = (
torch.as_tensor(self.retrieve_memories(global_agent_ids)).unsqueeze(0)
if self.use_recurrent
else None
)
run_out = {}

2
ml-agents/mlagents/trainers/torch/components/bc/module.py


)
)
memories = []
memories = None
if self.policy.use_recurrent:
memories = torch.zeros(1, self.n_sequences, self.policy.m_size)

正在加载...
取消
保存