code: def adam(learning_rate, hparams):
      """Return adam optimizer for the given params."""
      # We change the default epsilon for Adam.
      # Using LazyAdam as it's much faster for large vocabulary embeddings.
      if contrib.is_tf2:
          # in TF2 beta1 -> beta_1 :/
          return contrib.opt().LazyAdamOptimizer(
              learning_rate,
              beta_1=hparams.optimizer_adam_beta1,
              beta_2=hparams.optimizer_adam_beta2,
              epsilon=hparams.optimizer_adam_epsilon,
          )
      else:
          return contrib.opt().LazyAdamOptimizer(
              learning_rate,
              beta1=hparams.optimizer_adam_beta1,
              beta2=hparams.optimizer_adam_beta2,
              epsilon=hparams.optimizer_adam_epsilon,
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import adafactor
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import misc_utils
  from tensor2tensor.utils import mlperf_log
  from tensor2tensor.utils import multistep_optimizer
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import yellowfin
  import tensorflow.compat.v1
  from tensorflow.python.framework import dtypes
label_desc: Use image node_id 3 for calling a global function with example usage: adam(learning_rate, hparams) and returns: contrib, contrib