Skip to content

Commit

Permalink
Fix error in torch Lie API example. (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisenp authored Jul 7, 2023
1 parent 6b446ab commit 7f8f1aa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/torchlie_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch

import torchlie as lie
Expand Down Expand Up @@ -107,11 +111,14 @@ def is_shared(t1, t2): # utility to check if memory is shared
out2 = g1 * g2
torch.testing.assert_close(out1, out2, check_dtype=True)

# Transfrom from (from local to world coordinate frame)
# Transfrom (from local to world coordinate frame)
# Untransfrom (from world to local coordinate frame)
p = torch.randn(batch_size, 3)
pt1 = g1.transform_from(p)
pt1 = g1.transform(p)
pt2 = g1 @ p
torch.testing.assert_close(pt1, pt2)
pback = g1.untransform(pt1)
torch.testing.assert_close(p, pback)

# For convenience, we provide a context to drop all ltype checks, and operate
# on raw tensor data. However, keep in mind that this is prone to error.
Expand Down

0 comments on commit 7f8f1aa

Please sign in to comment.