15
15
16
16
from absl .testing import flagsaver
17
17
from absl .testing import parameterized
18
- import tensorflow . compat . v2 as tf
18
+ import tensorflow as tf
19
19
20
20
from tensorflow_graphics .geometry .transformation import dual_quaternion
21
21
from tensorflow_graphics .geometry .transformation .tests import test_helpers
@@ -29,30 +29,25 @@ class DualQuaternionTest(test_case.TestCase):
29
29
((None , 8 ),),
30
30
)
31
31
def test_conjugate_exception_not_raised (self , * shape ):
32
- """Tests that the shape exceptions of conjugate are not raised."""
33
32
self .assert_exception_is_not_raised (dual_quaternion .conjugate , shape )
34
33
35
34
@parameterized .parameters (
36
35
("must have exactly 8 dimensions" , (3 ,)),)
37
36
def test_conjugate_exception_raised (self , error_msg , * shape ):
38
- """Tests that the shape exceptions are raised."""
39
37
self .assert_exception_is_raised (dual_quaternion .conjugate , error_msg , shape )
40
38
41
39
@flagsaver .flagsaver (tfg_add_asserts_to_graph = False )
42
40
def test_conjugate_jacobian_preset (self ):
43
- """Tests the Jacobian of the conjugate function."""
44
41
x_init = test_helpers .generate_preset_test_dual_quaternions ()
45
42
self .assert_jacobian_is_correct_fn (dual_quaternion .conjugate , [x_init ])
46
43
47
44
@flagsaver .flagsaver (tfg_add_asserts_to_graph = False )
48
45
def test_conjugate_jacobian_random (self ):
49
- """Tests the Jacobian of the conjugate function."""
50
46
x_init = test_helpers .generate_random_test_dual_quaternions ()
51
47
self .assert_jacobian_is_correct_fn (dual_quaternion .conjugate , [x_init ])
52
48
53
49
@flagsaver .flagsaver (tfg_add_asserts_to_graph = False )
54
50
def test_conjugate_preset (self ):
55
- """Tests if the conjugate function is providing correct results."""
56
51
x_init = test_helpers .generate_preset_test_dual_quaternions ()
57
52
x = tf .convert_to_tensor (value = x_init )
58
53
y = tf .convert_to_tensor (value = x_init )
@@ -68,3 +63,37 @@ def test_conjugate_preset(self):
68
63
69
64
self .assertAllEqual (x_real , y_real )
70
65
self .assertAllEqual (x_dual , y_dual )
66
+
67
+ @parameterized .parameters (
68
+ ((8 ,), (8 ,)),
69
+ ((None , 8 ), (None , 8 )),
70
+ )
71
+ def test_multiply_exception_not_raised (self , * shapes ):
72
+ self .assert_exception_is_not_raised (dual_quaternion .multiply , shapes )
73
+
74
+ @parameterized .parameters (
75
+ ("must have exactly 8 dimensions" , (5 ,), (6 ,)),
76
+ ("must have exactly 8 dimensions" , (7 ,), (8 ,)),
77
+ )
78
+ def test_multiply_exception_raised (self , error_msg , * shape ):
79
+ self .assert_exception_is_raised (dual_quaternion .multiply , error_msg , shape )
80
+
81
+ @flagsaver .flagsaver (tfg_add_asserts_to_graph = False )
82
+ def test_multiply_jacobian_preset (self ):
83
+ x_1_init = test_helpers .generate_preset_test_dual_quaternions ()
84
+ x_2_init = test_helpers .generate_preset_test_dual_quaternions ()
85
+
86
+ self .assert_jacobian_is_correct_fn (dual_quaternion .multiply ,
87
+ [x_1_init , x_2_init ])
88
+
89
+ @flagsaver .flagsaver (tfg_add_asserts_to_graph = False )
90
+ def test_multiply_jacobian_random (self ):
91
+ x_1_init = test_helpers .generate_random_test_dual_quaternions ()
92
+ x_2_init = test_helpers .generate_random_test_dual_quaternions ()
93
+
94
+ self .assert_jacobian_is_correct_fn (dual_quaternion .multiply ,
95
+ [x_1_init , x_2_init ])
96
+
97
+
98
+ if __name__ == "__main__" :
99
+ test_case .main ()
0 commit comments