Skip to content

Conversation

@ssandler-cat
Copy link

@ssandler-cat ssandler-cat commented Mar 8, 2024

Making the code torch.jit.script() friendly; torch.jit.trace() is also supported.
See issues/83.

Making the code torch.jit.script() friendly; torch.jit.trace() is also supported.
@google-cla
Copy link

google-cla bot commented Mar 8, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Comment on lines +211 to +214
out = (torch.mean(torch.stack(trajectories.occlusion[p::p]), dim=0),
torch.mean(torch.stack(trajectories.tracks[p::p]), dim=0),
torch.mean(torch.stack(trajectories.expected_dist[p::p]), dim=0)
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a use case to return unrefined_occlusion, unrefined_tracks and unrefined_expected_dist then the code should be modified as

    out = (torch.mean(torch.stack(trajectories.occlusion[p::p]), dim=0),       # occlusion
           torch.mean(torch.stack(trajectories.tracks[p::p]), dim=0),          # tracks
           torch.mean(torch.stack(trajectories.expected_dist[p::p]), dim=0),   # expected_dist
           trajectories.occlusion[:-1],                                        # unrefined_occlusion
           trajectories.tracks[:-1],                                           # unrefined_tracks
           trajectories.expected_dist[:-1]                                     # unrefined_expected_dist        
          )

having -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: replaced with -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, list[torch.Tensor], list[torch.Tensor], list[torch.Tensor]]: in the forward annotation.

@yangyi02
Copy link
Collaborator

Thank you @SergeySandler for addressing the Torchscript compatibility issue here. Merging your code from Github backward into Google codebase is a little painful. But really appreciate your effort. We will see if we can do it from the Google side and push it forward to Github instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants