def METHOD_NAME(learning_rate, warmup_steps, num_train_steps):
    """Applies linear warmup of learning rate from 0 and decay to 0."""
    with fluid.default_main_program()._lr_schedule_guard():
        lr = fluid.layers.tensor.create_global_var(
            shape=[1], value=0.0, dtype="float32", persistable=True, name="scheduled_learning_rate"
        )
        global_step = fluid.layers.learning_rate_scheduler._decay_step_counter()
        with fluid.layers.control_flow.Switch() as switch:
            with switch.case(global_step < warmup_steps):
                warmup_lr = learning_rate * (global_step / warmup_steps)
                fluid.layers.tensor.assign(warmup_lr, lr)
            with switch.default():
                decayed_lr = fluid.layers.learning_rate_scheduler.polynomial_decay(
                    learning_rate=learning_rate,
                    decay_steps=num_train_steps,
                    end_learning_rate=0.0,
                    power=1.0,
                    cycle=False,
                )
                fluid.layers.tensor.assign(decayed_lr, lr)
        return lr