File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,16 @@ def test_quantile_ordering(quantiles, unordered):
5353
5454
5555def test_positive_definite (positive_definite , batch_size , num_variables ):
56- psd = positive_definite
57- input_shape = psd .compute_input_shape ((batch_size , num_variables , num_variables ))
58- print (input_shape )
59- random_preactivation = keras .random .normal (input_shape , seed = 12 )
60- output = psd (random_preactivation )
56+ input_shape = positive_definite .compute_input_shape ((batch_size , num_variables , num_variables ))
6157
58+ # Too strongly negative values lead to numerical instabilities -> reduce scale
59+ random_preactivation = keras .random .normal (input_shape ) * 0.1
60+ output = positive_definite (random_preactivation )
61+
62+ # Check if output is invertible
63+ np .linalg .inv (output )
64+
65+ # Calculated eigenvalues to test for positive definiteness
6266 output = keras .ops .convert_to_numpy (output )
6367 eigenvalues = np .linalg .eig (output ).eigenvalues
6468
You can’t perform that action at this time.
0 commit comments