浏览代码

Fix gpu pytests (#5019)

* Move tensors to cpu before converting it to numpy
/develop/gail-srl-hack
GitHub 4 年前
当前提交
c1d19e89
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 4
      ml-agents/mlagents/trainers/optimizer/torch_optimizer.py

4
ml-agents/mlagents/trainers/optimizer/torch_optimizer.py


# For the first sequence, the initial memory should be the one at the
# beginning of this trajectory.
for _ in range(first_seq_len):
all_next_memories.append(initial_memory.squeeze().detach().numpy())
all_next_memories.append(ModelUtils.to_numpy(initial_memory.squeeze()))
init_values, _mem = self.critic.critic_pass(
seq_obs, initial_memory, sequence_length=first_seq_len

):
seq_obs = []
for _ in range(self.policy.sequence_length):
all_next_memories.append(_mem.squeeze().detach().numpy())
all_next_memories.append(ModelUtils.to_numpy(_mem.squeeze()))
for _obs in tensor_obs:
start = seq_num * self.policy.sequence_length - (
self.policy.sequence_length - leftover

正在加载...
取消
保存