def test_step_schedule(backend_default):
 step_config = [1, 4, 5]
 change = [0.1, 0.3, 0.4]
 sch = StepSchedule(step_config=step_config, change=change)
 target_lr = [1.0, 0.1, 0.1, 0.1, 0.3, 0.4, 0.4, 0.4, 0.4]
 for (e, lr) in enumerate(target_lr):
  assert np.allclose(lr, sch.get_learning_rate(learning_rate=1.0, epoch=e))

def test_step_schedule ( backend_default ) : step_config = [ 1 , 4 , 5 ] change = [ 0.1 , 0.3 , 0.4 ] sch = StepSchedule ( step_config = step_config , change = change ) target_lr = [ 1.0 , 0.1 , 0.1 , 0.1 , 0.3 , 0.4 , 0.4 , 0.4 , 0.4 ] for ( e , lr ) in enumerate ( target_lr ) : assert np . allclose ( lr , sch . get_learning_rate ( learning_rate = 1.0 , epoch = e ) )
test the stepschedule class .