浏览代码

agent processor tests

/develop/action-spec-gym
Andrew Cohen 4 年前
当前提交
762274d9
共有 1 个文件被更改,包括 12 次插入10 次删除
  1. 22
      ml-agents/mlagents/trainers/tests/test_agent_processor.py

22
ml-agents/mlagents/trainers/tests/test_agent_processor.py


)
fake_action_outputs = {
"action": [0.1, 0.1],
"action": {"continuous_action": [0.1, 0.1]},
"log_probs": [0.1, 0.1],
"log_probs": {"continuous_log_probs": [0.1, 0.1]},
}
mock_decision_steps, mock_terminal_steps = mb.create_mock_steps(
num_agents=2,

fake_action_info = ActionInfo(
action=[0.1, 0.1],
action={"continuous_action": [0.1, 0.1]},
value=[0.1, 0.1],
outputs=fake_action_outputs,
agent_ids=mock_decision_steps.agent_id,

)
fake_action_outputs = {
"action": [0.1],
"action": {"continuous_action": [0.1]},
"log_probs": [0.1],
"log_probs": {"continuous_log_probs": [0.1]},
}
mock_decision_step, mock_terminal_step = mb.create_mock_steps(
num_agents=1,

done=True,
)
fake_action_info = ActionInfo(
action=[0.1],
action={"continuous_action": [0.1]},
value=[0.1],
outputs=fake_action_outputs,
agent_ids=mock_decision_step.agent_id,

processor.add_experiences(
mock_decision_step, mock_terminal_step, _ep, fake_action_info
)
add_calls.append(mock.call([get_global_agent_id(_ep, 0)], [0.1]))
add_calls.append(
mock.call([get_global_agent_id(_ep, 0)], {"continuous_action": [0.1]})
)
processor.add_experiences(
mock_done_decision_step, mock_done_terminal_step, _ep, fake_action_info
)

)
fake_action_outputs = {
"action": [0.1],
"action": {"continuous_action": [0.1]},
"log_probs": [0.1],
"log_probs": {"continuous_log_probs": [0.1]},
}
mock_decision_step, mock_terminal_step = mb.create_mock_steps(
num_agents=1,

fake_action_info = ActionInfo(
action=[0.1],
action={"continuous_action": [0.1]},
value=[0.1],
outputs=fake_action_outputs,
agent_ids=mock_decision_step.agent_id,

正在加载...
取消
保存