def test_opt_failure(self): base_opt = None for sequential_update in [True, False]: with self.assertRaises(TypeError): MovingAverage(base_opt, 0.5, sequential_update)
def test_optimizer_string(): _ = MovingAverage("adam")
def test_opt_failure(): base_opt = None with pytest.raises(TypeError): MovingAverage(base_opt, 0.5)
def test_num_updates_invalid(): for num_updates in [1.0, tf.Variable(1.0), "a"]: with pytest.raises(TypeError): MovingAverage("sgd", num_updates=num_updates)
def test_num_updates_valid(): for num_updates in [1, tf.Variable(1)]: MovingAverage("sgd", num_updates=num_updates)
def wrap(opt): return MovingAverage(Lookahead(opt))
def test_optimizer_string(self): _ = MovingAverage('adam')