From 7f8f1aa8d9bb693c8c785046cd3c380adc587ca1 Mon Sep 17 00:00:00 2001 From: Luis Pineda <4759586+luisenp@users.noreply.github.com> Date: Fri, 7 Jul 2023 18:25:30 -0400 Subject: [PATCH] Fix error in torch Lie API example. (#575) --- examples/torchlie_api.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/torchlie_api.py b/examples/torchlie_api.py index 1ac083dc..083b5ee4 100644 --- a/examples/torchlie_api.py +++ b/examples/torchlie_api.py @@ -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 @@ -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.