Skip to content

Commit

Permalink
Fix some import errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
luisenp committed Jan 20, 2023
1 parent 4ec1640 commit 04fa10a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
26 changes: 23 additions & 3 deletions tests/labs/lie_functional/test_se3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
# LICENSE file in the root directory of this source tree.

import pytest
from .common import check_lie_group_function, left_project_func
from theseus.geometry.functional.constants import TEST_EPS
import theseus.geometry.functional.se3 as se3
from .common import check_lie_group_function, left_project_func, TEST_EPS

import torch

Expand All @@ -17,6 +15,8 @@
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_exp(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
rng.manual_seed(0)
tangent_vector = torch.rand(batch_size, 6, dtype=dtype, generator=rng)
Expand All @@ -29,6 +29,8 @@ def test_exp(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_log(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
rng.manual_seed(0)
group = se3.rand(batch_size, generator=rng, dtype=dtype)
Expand All @@ -43,6 +45,8 @@ def test_log(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_adjoint(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
rng.manual_seed(0)
group = se3.rand(batch_size, generator=rng, dtype=dtype)
Expand All @@ -55,6 +59,8 @@ def test_adjoint(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_inverse(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
rng.manual_seed(0)
group = se3.rand(batch_size, generator=rng, dtype=dtype)
Expand All @@ -67,6 +73,8 @@ def test_inverse(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_hat(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
rng.manual_seed(0)
tangent_vector = torch.rand(batch_size, 6, dtype=dtype, generator=rng)
Expand All @@ -79,6 +87,8 @@ def test_hat(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_vee(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
rng.manual_seed(0)
tangent_vector = torch.rand(batch_size, 6, dtype=dtype, generator=rng)
Expand All @@ -96,6 +106,8 @@ def test_vee(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_compose(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
rng.manual_seed(0)
group0 = se3.rand(batch_size, generator=rng, dtype=dtype)
Expand All @@ -109,6 +121,8 @@ def test_compose(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_lift(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
matrix = torch.rand(
batch_size,
Expand All @@ -126,6 +140,8 @@ def test_lift(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_project(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
matrix = torch.rand(
batch_size,
Expand All @@ -144,6 +160,8 @@ def test_project(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_left_act(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
group = se3.rand(batch_size, dtype=dtype, generator=rng)
matrix = torch.rand(
Expand Down Expand Up @@ -175,6 +193,8 @@ def test_left_act(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_left_project(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.se3 as se3

rng = torch.Generator()
group = se3.rand(batch_size, dtype=dtype, generator=rng)
matrix = torch.rand(
Expand Down
19 changes: 15 additions & 4 deletions tests/labs/lie_functional/test_so3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
# LICENSE file in the root directory of this source tree.

import pytest
from .common import check_lie_group_function, left_project_func
from theseus.geometry.functional.constants import TEST_EPS
import theseus.geometry.functional.so3 as so3

import torch

from tests.decorators import run_if_labs
from .common import TEST_EPS, check_lie_group_function
from .common import TEST_EPS, check_lie_group_function, left_project_func


@run_if_labs()
Expand All @@ -32,6 +29,8 @@ def test_exp(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_log(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.so3 as so3

rng = torch.Generator()
rng.manual_seed(0)
group = so3.rand(batch_size, generator=rng, dtype=dtype)
Expand Down Expand Up @@ -107,6 +106,8 @@ def test_vee(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_compose(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.so3 as so3

rng = torch.Generator()
rng.manual_seed(0)
group0 = so3.rand(batch_size, generator=rng, dtype=dtype)
Expand All @@ -120,6 +121,8 @@ def test_compose(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_quaternion_to_rotation(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.so3 as so3

rng = torch.Generator()
rng.manual_seed(0)
quaternion = torch.rand(batch_size, 4, dtype=dtype, generator=rng)
Expand All @@ -133,6 +136,8 @@ def test_quaternion_to_rotation(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_lift(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.so3 as so3

rng = torch.Generator()
matrix = torch.rand(
batch_size,
Expand All @@ -150,6 +155,8 @@ def test_lift(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_project(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.so3 as so3

rng = torch.Generator()
matrix = torch.rand(
batch_size,
Expand All @@ -168,6 +175,8 @@ def test_project(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_left_act(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.so3 as so3

rng = torch.Generator()
group = so3.rand(batch_size, dtype=dtype, generator=rng)
matrix = torch.rand(
Expand Down Expand Up @@ -199,6 +208,8 @@ def test_left_act(batch_size: int, dtype: torch.dtype):
@pytest.mark.parametrize("batch_size", [1, 20, 100])
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_left_project(batch_size: int, dtype: torch.dtype):
import theseus.labs.lie_functional.so3 as so3

rng = torch.Generator()
group = so3.rand(batch_size, dtype=dtype, generator=rng)
matrix = torch.rand(
Expand Down

0 comments on commit 04fa10a

Please sign in to comment.