Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor vmap fix in SO2 #362

Merged
merged 2 commits into from
Nov 16, 2022
Merged

Minor vmap fix in SO2 #362

merged 2 commits into from
Nov 16, 2022

Conversation

luisenp
Copy link
Contributor

@luisenp luisenp commented Nov 15, 2022

Creating the new tensor from cosine is better, since our typical use case uses vmap over the optimization variable. The previous version could result in errors in AutodiffCostFunction in some corner cases (@rmurai0610 hit one of these). The caveat is that the new version will fail if we vmap over the points, but there is no easy workaround for this. From conversation with @zou3519 it seems that functorch team is working on some better API to lift tensors to their batched versions.

@luisenp luisenp self-assigned this Nov 15, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 15, 2022
Copy link
Contributor

@fantaosha fantaosha left a comment

Choose a reason for hiding this comment

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

Good catch!

theseus/geometry/so2.py Outdated Show resolved Hide resolved
Copy link
Contributor

@fantaosha fantaosha left a comment

Choose a reason for hiding this comment

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

LGTM.

@luisenp luisenp merged commit 1788a34 into main Nov 16, 2022
@luisenp luisenp deleted the lep.minor_so2_vmap_fix branch November 16, 2022 16:23
suddhu pushed a commit to suddhu/theseus that referenced this pull request Jan 21, 2023
* Changed SO2._rotate_from_cos_sin to use cosine rather than point for creating new batched tensor.

* Changed SO2._rotate_from_cos_sin to avoid in-place indexing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants