@@ -71,8 +71,8 @@ def test_state_initialization(self, shape) -> None:
7171 expected_exp_avg_sq = (1 - beta2 ) * grad .square ()
7272 normalized_grad = grad / (grad .abs () + optimizer .param_groups [0 ]["eps" ])
7373 expected_exp_avg = (1 - beta1 ) * normalized_grad
74- torch .testing .assert_close (optimizer .state [param ]["exp_avg_sq" ], expected_exp_avg_sq )
75- torch .testing .assert_close (optimizer .state [param ]["exp_avg" ], expected_exp_avg )
74+ torch .testing .assert_close (optimizer .state [param ]["exp_avg_sq" ], expected_exp_avg_sq , atol = 0 , rtol = 0 )
75+ torch .testing .assert_close (optimizer .state [param ]["exp_avg" ], expected_exp_avg , atol = 0 , rtol = 0 )
7676
7777 @parameterized .parameters (
7878 {"shape" : (3 , 3 )},
@@ -96,9 +96,9 @@ def test_optimizer_step_matches_update_function(self, shape) -> None:
9696 param .grad = grad .clone ()
9797 optimizer .step ()
9898
99- torch .testing .assert_close (param , old_param - lr * expected_update )
100- torch .testing .assert_close (optimizer .state [param ]["exp_avg" ], exp_avg )
101- torch .testing .assert_close (optimizer .state [param ]["exp_avg_sq" ], exp_avg_sq )
99+ torch .testing .assert_close (param , old_param - lr * expected_update , atol = 0 , rtol = 0 )
100+ torch .testing .assert_close (optimizer .state [param ]["exp_avg" ], exp_avg , atol = 0 , rtol = 0 )
101+ torch .testing .assert_close (optimizer .state [param ]["exp_avg_sq" ], exp_avg_sq , atol = 0 , rtol = 0 )
102102
103103 @parameterized .parameters (
104104 {"shape" : (3 , 3 )},
@@ -118,10 +118,10 @@ def test_no_grad_no_update_params_unchanged(self, shape) -> None:
118118 {"shape" : (15 , 31 )},
119119 {"shape" : (127 , 255 )},
120120 )
121- def test_normalize_preserves_parameter_norm (self , shape ) -> None :
121+ def test_frob_normalize_preserves_parameter_norm (self , shape ) -> None :
122122 """LaProp can normalize updated parameters back to their pre-update norm."""
123123 param = torch .nn .Parameter (torch .randint (1 , 5 , shape , device = self .device , dtype = torch .float32 ))
124- optimizer = LaProp ([param ], lr = 0.25 , weight_decay = 0.0 , normalize = True )
124+ optimizer = LaProp ([param ], lr = 0.25 , weight_decay = 0.0 , frob_normalize = True )
125125 param .grad = torch .randint (1 , 5 , shape , device = self .device , dtype = torch .float32 )
126126 original_norm = param .norm ()
127127
@@ -168,12 +168,6 @@ def test_negative_eps_raises_value_error(self) -> None:
168168 with self .assertRaisesRegex (ValueError , "Invalid epsilon" ):
169169 LaProp ([param ], eps = - 1e-8 )
170170
171- def test_non_positive_normalize_eps_raises_value_error (self ) -> None :
172- """Test that LaProp raises ValueError for non-positive normalize_eps."""
173- param = torch .nn .Parameter (torch .randn (3 , 3 , device = self .device ))
174- with self .assertRaisesRegex (ValueError , "Invalid normalize_eps" ):
175- LaProp ([param ], normalize_eps = 0.0 )
176-
177171 def test_negative_weight_decay_raises_value_error (self ) -> None :
178172 """Test that LaProp raises ValueError for negative weight_decay."""
179173 param = torch .nn .Parameter (torch .randn (3 , 3 , device = self .device ))
0 commit comments