(self, inputs, current_states=None, EC_feat=None, num_steps=None)
| 1431 | traj = torch.cat((pos, yaw), dim=-1) |
| 1432 | return traj |
| 1433 | def forward(self, inputs, current_states=None, EC_feat=None, num_steps=None): |
| 1434 | preds, EC_preds = self._forward_networks( |
| 1435 | inputs, EC_feat, current_states=current_states, num_steps=num_steps) |
| 1436 | if self.dyn is not None: |
| 1437 | preds["controls"] = preds["trajectories"] |
| 1438 | if EC_preds is None: |
| 1439 | preds["trajectories"] = self._forward_dynamics( |
| 1440 | current_states=current_states, |
| 1441 | actions=preds["trajectories"] |
| 1442 | ) |
| 1443 | else: |
| 1444 | total_actions = torch.cat((preds["trajectories"].unsqueeze(1),EC_preds["trajectories"]),1) |
| 1445 | bs,A,T,D = total_actions.shape |
| 1446 | current_states_tiled = current_states.unsqueeze(1).repeat(1,total_actions.size(1),1) |
| 1447 | total_trajectories = self._forward_dynamics( |
| 1448 | current_states=current_states_tiled.reshape(bs*A,-1), |
| 1449 | actions=total_actions.reshape(bs*A,T,D) |
| 1450 | ).reshape(*total_actions.shape[:-1],-1) |
| 1451 | preds["trajectories"] = total_trajectories[:,0] |
| 1452 | preds["EC_trajectories"] = total_trajectories[:,1:] |
| 1453 | else: |
| 1454 | preds["EC_trajectories"] = EC_preds["trajectories"] |
| 1455 | |
| 1456 | return preds |
| 1457 | |
| 1458 | |
| 1459 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected