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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions theseus/geometry/so2.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ def _rotate_from_cos_sin(
cosine: torch.Tensor,
sine: torch.Tensor,
) -> Point2:
batch_size = max(point.shape[0], cosine.shape[0])
if isinstance(point, torch.Tensor):
if point.ndim != 2 or point.shape[1] != 2:
raise ValueError(
Expand All @@ -260,10 +259,11 @@ def _rotate_from_cos_sin(
else:
point_tensor = point.tensor
px, py = point_tensor[:, 0], point_tensor[:, 1]
new_point_tensor = point_tensor.new_empty(batch_size, 2)
new_point_tensor[:, 0] = cosine * px - sine * py
new_point_tensor[:, 1] = sine * px + cosine * py
return Point2(tensor=new_point_tensor)
return Point2(
tensor=torch.stack(
[cosine * px - sine * py, sine * px + cosine * py], dim=1
)
)

def rotate(
self,
Expand Down