Skip to content

Commit

Permalink
fix unittest for LSVRG
Browse files Browse the repository at this point in the history
  • Loading branch information
paskino committed Jul 21, 2024
1 parent 7f16acb commit c6d7f29
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Wrappers/Python/test/test_approximate_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,4 +531,14 @@ def test_LSVRG_toy_example_store_gradients(self):
self.assertNumpyArrayAlmostEqual(
alg_stochastic.x.as_array(), u_cvxpy.value, 3)
self.assertNumpyArrayAlmostEqual(
alg_stochastic.x.as_array(), b.as_array(), 3)
alg_stochastic.x.as_array(), b.as_array(), 3)

def test_sampler_out_of_range(self):
def g(index):
return -2
bad_sampler = Sampler.from_function(12,g)
f = self.stochastic_estimator([self.f]*10, bad_sampler, seed=3)
with self.assertRaises(IndexError):
f.gradient(self.initial)
f.gradient(self.initial)

0 comments on commit c6d7f29

Please sign in to comment.