Esempio n. 1
0
    def test_decay_steps_value(self):
        decay_steps_e = -2
        with pytest.raises(ValueError):
            lr_schedules.ExponentialDecayLR(learning_rate, decay_rate,
                                            decay_steps_e)

        with pytest.raises(ValueError):
            lr_schedules.CosineDecayLR(min_lr, max_lr, decay_steps_e)

        with pytest.raises(ValueError):
            lr_schedules.PolynomialDecayLR(learning_rate, end_learning_rate,
                                           decay_steps_e, power)
Esempio n. 2
0
 def test_max_lr_value(self):
     max_lr1 = -1.0
     with pytest.raises(ValueError):
         lr_schedules.CosineDecayLR(min_lr, max_lr1, decay_steps)
Esempio n. 3
0
def test_cosine_decay():
    lr_schedule = lr_schedules.CosineDecayLR(min_lr, max_lr, decay_steps)
    _executor.compile(lr_schedule, global_step)
Esempio n. 4
0
 def test_max_lr_type(self):
     max_lr1 = 'a'
     with pytest.raises(TypeError):
         lr_schedules.CosineDecayLR(min_lr, max_lr1, decay_steps)