def test_update_stepsize(self): """Tests that the stepsize correctly updates""" eta = 0.5 opt = AdamOptimizer(eta) assert opt._stepsize == eta eta2 = 0.1 opt.update_stepsize(eta2) assert opt._stepsize == eta2
def test_update_stepsize(self): """Tests that the stepsize correctly updates""" self.logTestName() eta = 0.5 opt = AdamOptimizer(eta) self.assertAlmostEqual(opt._stepsize, eta) eta2 = 0.1 opt.update_stepsize(eta2) self.assertAlmostEqual(opt._stepsize, eta2)
def test_update_stepsize(self): """ Tests whether the stepsize value is updated correctly and whether a ``UserWarning`` is raised when the ``update_stepsize`` method is used. """ eta = 0.5 opt = AdamOptimizer(eta) assert opt.stepsize == eta eta2 = 0.1 opt.update_stepsize(eta2) assert opt.stepsize == eta2 with pytest.warns( UserWarning, match="'update_stepsize' is deprecated. Stepsize value can be updated using " "the 'stepsize' attribute.", ): opt.update_stepsize(eta)