Skip to content

Commit

Permalink
Euler: use float64 for test
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain BRÉGIER committed Apr 23, 2024
1 parent 8f6a2ed commit 0768dfd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/test_euler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test_euler(self):

def test_euler_unitquat_consistency(self):
device = torch.device(0) if torch.cuda.is_available() else torch.device('cpu')
dtype = torch.float64
for degrees in (True, False):
for batch_shape in [tuple(),
torch.Size((30,)),
Expand All @@ -28,7 +29,7 @@ def test_euler_unitquat_consistency(self):
for convention in ["".join(permutation) for permutation in itertools.permutations('xyz')] + ["xyx", "xzx", "yxy", "yzy", "zxz", "zyz"]:
if intrinsics:
convention = convention.upper()
q = roma.random_unitquat(batch_shape, device=device)
q = roma.random_unitquat(batch_shape, device=device, dtype=dtype)
angles = roma.unitquat_to_euler(convention, q, degrees=degrees)
self.assertTrue(len(angles) == 3)
self.assertTrue(all([angle.shape == batch_shape for angle in angles]))
Expand Down Expand Up @@ -63,6 +64,7 @@ def test_euler_rotvec_consistency(self):

def test_euler_rotmat_consistency(self):
device = torch.device(0) if torch.cuda.is_available() else torch.device('cpu')
dtype = torch.float64
for degrees in (True, False):
for batch_shape in [tuple(),
torch.Size((30,)),
Expand All @@ -71,7 +73,7 @@ def test_euler_rotmat_consistency(self):
for convention in ["".join(permutation) for permutation in itertools.permutations('xyz')] + ["xyx", "xzx", "yxy", "yzy", "zxz", "zyz"]:
if intrinsics:
convention = convention.upper()
q = roma.random_rotmat(batch_shape, device=device)
q = roma.random_rotmat(batch_shape, device=device, dtype=dtype)
angles = roma.rotmat_to_euler(convention, q, degrees=degrees)
self.assertTrue(len(angles) == 3)
self.assertTrue(all([angle.shape == batch_shape for angle in angles]))
Expand All @@ -96,7 +98,8 @@ def test_euler_tensor(self):
Test that Euler conversion methods support both list and tensor inputs.
"""
batch_shape = (10,34)
q = roma.random_unitquat(batch_shape, device=device)
dtype = torch.float64
q = roma.random_unitquat(batch_shape, device=device, dtype=dtype)
convention = 'xyz'
angles = roma.unitquat_to_euler(convention, q)
angles_tensor = roma.unitquat_to_euler(convention, q, as_tensor=True)
Expand Down

0 comments on commit 0768dfd

Please sign in to comment.