def test_total_step1(self): total_step1 = 2.0 with pytest.raises(ValueError): dr.exponential_decay_lr(learning_rate, decay_rate, total_step1, step_per_epoch, decay_epoch) with pytest.raises(ValueError): dr.cosine_decay_lr(min_lr, max_lr, total_step1, step_per_epoch, decay_epoch) with pytest.raises(ValueError): dr.polynomial_decay_lr(learning_rate, end_learning_rate, total_step1, step_per_epoch, decay_epoch, power)
def test_decay_epoch1(self): decay_epoch1 = 'm' with pytest.raises(TypeError): dr.exponential_decay_lr(learning_rate, decay_rate, total_step, step_per_epoch, decay_epoch1) with pytest.raises(TypeError): dr.cosine_decay_lr(min_lr, max_lr, total_step, step_per_epoch, decay_epoch1) with pytest.raises(TypeError): dr.polynomial_decay_lr(learning_rate, end_learning_rate, total_step, step_per_epoch, decay_epoch1, power)
def test_cosine_decay(): lr = dr.cosine_decay_lr(min_lr, max_lr, total_step, step_per_epoch, decay_epoch) assert len(lr) == total_step
def test_max_lr_value(self): max_lr1 = -1.0 with pytest.raises(ValueError): dr.cosine_decay_lr(min_lr, max_lr1, total_step, step_per_epoch, decay_epoch)
def test_max_lr_type(self): max_lr1 = 'a' with pytest.raises(TypeError): dr.cosine_decay_lr(min_lr, max_lr1, total_step, step_per_epoch, decay_epoch)