bugfix in deepsets
This commit is contained in:
@@ -63,7 +63,7 @@ class DeepSetsModule(nn.Module):
|
||||
# shape (B, max_nv)
|
||||
notnan_mask = torch.all(~torch.isnan(x), dim=-1)
|
||||
# create zero tensor of shape (B, max_nv, latent_dim) to store phi evaluations in
|
||||
latent = torch.zeros([*x.shape[:-1], self.latent_dim])
|
||||
latent = torch.zeros([*x.shape[:-1], self.latent_dim], dtype=x.dtype)
|
||||
# evaluate phi for all not NaN entries
|
||||
# x[batch_dynamic_mask] has shape (notnan_mask.sum(), input_dim)
|
||||
latent[notnan_mask] = self.phi(x[notnan_mask])
|
||||
|
||||
@@ -42,6 +42,6 @@ class DeepSetsPolicy(Policy, nn.Module):
|
||||
# cat path_x, path_y to tensor of dim (B, 2*P)
|
||||
path = torch.cat([sample["path_x"], sample["path_y"]], dim=-1)
|
||||
path = self.path_net(path)
|
||||
x = torch.cat([ego, relative, path])
|
||||
x = torch.cat([ego, relative, path], dim=-1)
|
||||
x = self.head(x)
|
||||
return x
|
||||
|
||||
@@ -9,6 +9,9 @@ with open(config_path, 'r') as cfg:
|
||||
|
||||
filestr = 'tests/policies/base_'
|
||||
|
||||
|
||||
batch = pickle.load(open(filestr+'_test_batch.pkl', 'rb'))
|
||||
batch['relative_state'] = batch['relative_state'].float()
|
||||
policy = BehaviorCloningPolicy.load_model(config, filestr)
|
||||
policy.policy = policy.policy.type(batch['state'].dtype)
|
||||
action = policy(batch)
|
||||
@@ -26,3 +26,5 @@ def test_deepsets_policy():
|
||||
}
|
||||
|
||||
module(sample)
|
||||
|
||||
# TODO: Refine test to also test for batch data
|
||||
Reference in New Issue
Block a user