|
1 | 1 | import math |
2 | | -from collections import OrderedDict |
3 | 2 |
|
4 | 3 | import torch |
5 | 4 | from pytest import mark, raises |
6 | | -from torch import Tensor |
7 | 5 | from unit.conftest import DEVICE |
8 | 6 |
|
9 | 7 | from torchjd._autojac._transform import ( |
@@ -72,37 +70,6 @@ def test_aggregate_matrices_empty_dict(): |
72 | 70 | assert len(gradient_vectors) == 0 |
73 | 71 |
|
74 | 72 |
|
75 | | -@mark.parametrize( |
76 | | - ["united_gradient_vector", "jacobian_matrices"], |
77 | | - [ |
78 | | - ( |
79 | | - torch.ones(10), |
80 | | - { # Total number of parameters according to the united gradient vector: 10 |
81 | | - torch.ones(5): torch.ones(2, 5), |
82 | | - torch.ones(4): torch.ones(2, 4), |
83 | | - }, |
84 | | - ), # Total number of parameters according to the jacobian matrices: 9 |
85 | | - ( |
86 | | - torch.ones(10), |
87 | | - { # Total number of parameters according to the united gradient vector: 10 |
88 | | - torch.ones(5): torch.ones(2, 5), |
89 | | - torch.ones(3): torch.ones(2, 3), |
90 | | - torch.ones(3): torch.ones(2, 3), |
91 | | - }, |
92 | | - ), # Total number of parameters according to the jacobian matrices: 11 |
93 | | - ], |
94 | | -) |
95 | | -def test_disunite_wrong_vector_length( |
96 | | - united_gradient_vector: Tensor, jacobian_matrices: dict[Tensor, Tensor] |
97 | | -): |
98 | | - """ |
99 | | - Tests that the _disunite method raises a ValueError when used on vectors of the wrong length. |
100 | | - """ |
101 | | - |
102 | | - with raises(ValueError): |
103 | | - _AggregateMatrices._disunite(united_gradient_vector, OrderedDict(jacobian_matrices)) |
104 | | - |
105 | | - |
106 | 73 | def test_matrixify(): |
107 | 74 | """Tests that the Matrixify transform correctly creates matrices from the jacobians.""" |
108 | 75 |
|
|
0 commit comments