code: def layer_decay(
      param, param_last, learning_rate, decay_rate, n_layers
  ):
      # encoder params
      delta = param - param_last
      encoder_layer_m = re.search("encoder_layer_([0-9]*)_", param.name)
      if encoder_layer_m is not None:
          layer = int(encoder_layer_m.group(1))
          ratio = decay_rate ** (n_layers + 1 - layer)
          log.info("layer deay %s: ratio %s." % (param.name, ratio))
          param_update = param + (ratio - 1) * delta
      elif "embedding" in param.name:
          ratio = decay_rate ** (n_layers + 2)
          param_update = param + (ratio - 1) * delta
      else:
          param_update = None
      return param_update
  
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 2 for calling a global function with example usage: layer_decay(param, param_last, learning_rate, decay_rate, n_layers) and returns: param_update