77
88from torchjd .aggregation import Constant
99
10- from ._inputs import scaled_matrices , typical_matrices
11- from ._property_testers import ExpectedStructureProperty , LinearUnderScalingProperty
10+ from ._inputs import non_strong_stationary_matrices , scaled_matrices , typical_matrices
11+ from ._property_testers import (
12+ ExpectedStructureProperty ,
13+ LinearUnderScalingProperty ,
14+ StrongStationarityProperty ,
15+ )
1216
1317# The weights must be a vector of length equal to the number of rows in the matrix that it will be
1418# applied to. Thus, each `Constant` instance is specific to matrices of a given number of rows. To
@@ -28,8 +32,13 @@ def _make_aggregator(matrix: Tensor) -> Constant:
2832_matrices_2 = typical_matrices
2933_aggregators_2 = [_make_aggregator (matrix ) for matrix in _matrices_2 ]
3034
35+ _matrices_3 = non_strong_stationary_matrices
36+ _aggregators_3 = [_make_aggregator (matrix ) for matrix in _matrices_3 ]
37+
3138
32- class TestConstant (ExpectedStructureProperty , LinearUnderScalingProperty ):
39+ class TestConstant (
40+ ExpectedStructureProperty , LinearUnderScalingProperty , StrongStationarityProperty
41+ ):
3342 # Override the parametrization of `test_expected_structure_property` to make the test use the
3443 # right aggregator with each matrix.
3544
@@ -43,6 +52,11 @@ def test_expected_structure_property(cls, aggregator: Constant, matrix: Tensor):
4352 def test_linear_under_scaling_property (cls , aggregator : Constant , matrix : Tensor ):
4453 cls ._assert_linear_under_scaling_property (aggregator , matrix )
4554
55+ @classmethod
56+ @mark .parametrize (["aggregator" , "matrix" ], zip (_aggregators_3 , _matrices_3 ))
57+ def test_stationarity_property (cls , aggregator : Constant , non_stationary_matrix : Tensor ):
58+ cls ._assert_stationarity_property (aggregator , non_stationary_matrix )
59+
4660
4761@mark .parametrize (
4862 ["weights_shape" , "expectation" ],
0 commit comments