code: def linear_warmup_decay(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
  
file_path: PGL/legacy/examples/erniesage/optimization.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from __future__ import absolute_import
  import numpy
  import re
  import paddle.fluid
  from propeller import log
label_desc: Use image node_id 1 for calling a global function with example usage: linear_warmup_decay(learning_rate, warmup_steps, num_train_steps) and returns: lr