MCPcopy Create free account
hub / github.com/NVlabs/CTG / predict

Method predict

tbsim/models/rasterized_models.py:1633–1646  ·  view source on GitHub ↗
(self, batch_inputs: dict)

Source from the content-addressed store, hash-verified

1631 return outs
1632
1633 def predict(self, batch_inputs: dict):
1634 pred_batch = self(batch_inputs,predict=True,cond_traj=None)
1635 z = torch.argmax(pred_batch["p"],-1)
1636 traj = pred_batch["x_recons"]["trajectories"]
1637 bs,M, = traj.shape[:2]
1638 Na = traj.shape[-3]
1639
1640 idx = z.reshape(bs,M,1,1,1,1).repeat(1,1,1,*traj.shape[-3:])
1641 traj_selected = torch.gather(traj,2,idx)
1642
1643 traj_selected = traj_selected[:,0].squeeze(1)
1644
1645 outs = self._traj_to_preds(traj_selected)
1646 return outs
1647 def compute_losses(self, pred_batch, data_batch):
1648 if data_batch["target_positions"].ndim==3:
1649 availability = torch.cat((data_batch["target_availabilities"].unsqueeze(1),data_batch["all_other_agents_future_availability"]),1)

Callers

nothing calls this directly

Calls 1

_traj_to_predsMethod · 0.95

Tested by

no test coverage detected