Files
InteractionImitation/tests/policies/test_policies.py
Johannes Fischer 5e89a83c88 Fix tests
2021-07-26 16:35:45 +02:00

30 lines
639 B
Python

import torch
from src.policies.policy import DeepSetsPolicy
import json5
config_path = "config/networks.json5"
with open(config_path, 'r') as cfg:
config = json5.load(cfg)
def test_deepsets_policy():
module = DeepSetsPolicy(config)
ns = 5
nv = 7
npath = 20
ego_state = torch.rand(ns)
relative_state = torch.rand(nv, ns)
path_x = torch.rand(npath)
path_y = torch.rand(npath)
sample = {
"state": ego_state,
"relative_state": relative_state,
"path_x": path_x,
"path_y": path_y,
}
module(sample)
# TODO: Refine test to also test for batch data