Beispiel #1
0
 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)
Beispiel #2
0
def test_optimizer_string():
    _ = MovingAverage("adam")
Beispiel #3
0
def test_opt_failure():
    base_opt = None
    with pytest.raises(TypeError):
        MovingAverage(base_opt, 0.5)
Beispiel #4
0
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)
Beispiel #5
0
def test_num_updates_valid():
    for num_updates in [1, tf.Variable(1)]:
        MovingAverage("sgd", num_updates=num_updates)
Beispiel #6
0
def wrap(opt):
    return MovingAverage(Lookahead(opt))
Beispiel #7
0
 def test_optimizer_string(self):
     _ = MovingAverage('adam')