浏览代码

add test

/develop/action-slice
Andrew Cohen 4 年前
当前提交
95f62362
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11
      ml-agents/mlagents/trainers/tests/torch/test_agent_action.py

11
ml-agents/mlagents/trainers/tests/torch/test_agent_action.py


assert (agent_1_act.discrete_tensor[3:] == 0).all()
def test_slice():
# Both continuous and discrete
aa = AgentAction(
torch.tensor([[1.0], [1.0], [1.0]]),
[torch.tensor([2, 1, 0]), torch.tensor([1, 2, 0])],
)
saa = aa.slice(0, 2)
assert saa.continuous_tensor.shape == (2, 1)
assert saa.discrete_tensor.shape == (2, 2)
def test_to_flat():
# Both continuous and discrete
aa = AgentAction(

正在加载...
取消
保存