浏览代码

Add presence check

/bullet-hell-barracuda-test-1.3.1
Ervin Teng 4 年前
当前提交
7014404a
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 5
      ml-agents/mlagents/trainers/policy/policy.py

5
ml-agents/mlagents/trainers/policy/policy.py


# Pass old memories into previous_memory_dict
for agent_id in agent_ids:
self.previous_memory_dict[agent_id] = self.memory_dict[agent_id]
if agent_id in self.memory_dict:
self.previous_memory_dict[agent_id] = self.memory_dict[agent_id]
for index, agent_id in enumerate(agent_ids):
self.memory_dict[agent_id] = memory_matrix[index, :]

def retrieve_previous_memories(self, agent_ids: List[str]) -> np.ndarray:
memory_matrix = np.zeros((len(agent_ids), self.m_size), dtype=np.float32)
for index, agent_id in enumerate(agent_ids):
if agent_id in self.memory_dict:
if agent_id in self.previous_memory_dict:
memory_matrix[index, :] = self.previous_memory_dict[agent_id]
return memory_matrix

正在加载...
取消
保存