code: def adam(
      parameters,
      lr,
      momentum,
      unit_gain=default_unit_gain_value(),
      variance_momentum=momentum_schedule_per_sample(
          0.9999986111120757
      ),
      l1_regularization_weight=0.0,
      l2_regularization_weight=0.0,
      gaussian_noise_injection_std_dev=0.0,
      gradient_clipping_threshold_per_sample=np.inf,
      gradient_clipping_with_truncation=True,
      use_mean_gradient=None,
      epsilon=1e-8,
      adamax=False,
      minibatch_size=None,
      epoch_size=None,
  ):
      """adam(parameters, lr, momentum, unit_gain=default_unit_gain_value(), variance_momentum=momentum_schedule_per_sample(0.9999986111120757), l1_regularization_weight=0, l2_regularization_weight=0, gaussian_noise_injection_std_dev=0, gradient_clipping_threshold_per_sample=np.inf, gradient_clipping_with_truncation=True, epsilon=1e-8, adamax=False)
      Creates an Adam learner instance to learn the parameters. See [1] for more
      information.
  
      Args:
          parameters (list of parameters): list of network parameters to tune.
           These can be obtained by the root operator's ``parameters``.
          lr (float, list, output of :func:`learning_parameter_schedule`): a learning rate in float, or a learning rate schedule.
           See also:  :func:`learning_parameter_schedule`
          momentum (float, list, output of :func:`momentum_schedule`): momentum schedule. Note that this is the beta1 parameter in the Adam paper [1].
           For additional information, please refer to the :cntkwiki:`this CNTK Wiki article <BrainScript-SGD-Block#converting-learning-rate-and-momentum-parameters-from-other-toolkits>`.
          unit_gain: when ``True``, momentum is interpreted as a unit-gain filter. Defaults
           to the value returned by :func:`default_unit_gain_value`.
          variance_momentum (float, list, output of :func:`momentum_schedule`): variance momentum schedule.
           Note that this is the beta2 parameter in the Adam paper [1]. Defaults to ``momentum_schedule_per_sample(0.9999986111120757)``.
          l1_regularization_weight (float, optional): the L1 regularization weight per sample,
           defaults to 0.0
          l2_regularization_weight (float, optional): the L2 regularization weight per sample,
           defaults to 0.0
          gaussian_noise_injection_std_dev (float, optional): the standard deviation
           of the Gaussian noise added to parameters post update, defaults to 0.0
          gradient_clipping_threshold_per_sample (float, optional): clipping threshold
           per sample, defaults to infinity
          gradient_clipping_with_truncation (bool, default ``True``): use gradient clipping
           with truncation
          use_mean_gradient (bool, optional): use averaged gradient as input to learner.
  
              deprecated:: 2.2
                  Use minibatch_size parameter to specify the reference minibatch size.
          epsilon (float, optional): numerical stability constant,
           defaults to 1e-8
          adamax: when ``True``, use infinity-norm variance momentum update instead of L2. Defaults
           to False
          minibatch_size (int, default ``None``): The minibatch size that the learner's parameters are designed or pre-tuned for. This
           size is usually set to the same as the minibatch data source's size. CNTK will perform automatic scaling of the parameters
           to enable efficient model parameter update implementation while approximate the behavior of pre-designed and pre-tuned parameters.
           In case that minibatch_size is not specified, CNTK will inherit the minibatch size from the learning rate schedule;
           if the learning rate schedule does not specify the minibatch_size, CNTK will set it to :attr:`IGNORE`. Setting minibatch_size to :attr:`IGNORE`
           will have the learner apply as it is preventing CNTK performing any hyper-parameter scaling. See also:  :func:`learning_parameter_schedule`
          epoch_size (optional, int): number of samples as a scheduling unit for learning rate, momentum and variance_momentum. See also:  :func:`learning_parameter_schedule`
  
      Returns:
          :class:`~cntk.learners.Learner`: learner instance that can be passed to
          the :class:`~cntk.train.trainer.Trainer`
  
      See also:
          [1] D. Kingma, J. Ba. `Adam: A Method for Stochastic Optimization
          <https://arxiv.org/abs/1412.6980>`_. International Conference for
          Learning Representations, 2015.
      """
      (
          lr,
          minibatch_size,
      ) = _infer_learning_rate_schedule_and_ref_minibatch_size(
          use_mean_gradient, minibatch_size, lr, epoch_size
      )
  
      momentum = _infer_learning_parameter_schedule(
          momentum, minibatch_size, epoch_size
      )
      _verify_momentum_type(momentum)
      variance_momentum = _infer_learning_parameter_schedule(
          variance_momentum, minibatch_size, epoch_size
      )
      _verify_momentum_type(variance_momentum)
      gaussian_noise_injection_std_dev = training_parameter_schedule(
          gaussian_noise_injection_std_dev
      )
  
      additional_options = cntk_py.AdditionalLearningOptions()
      additional_options.l1_regularization_weight = (
          l1_regularization_weight
      )
      additional_options.l2_regularization_weight = (
          l2_regularization_weight
      )
      additional_options.gaussian_noise_injection_std_dev = (
          gaussian_noise_injection_std_dev
      )
      additional_options.gradient_clipping_threshold_per_sample = (
          gradient_clipping_threshold_per_sample
      )
      additional_options.gradient_clipping_with_truncation = (
          gradient_clipping_with_truncation
      )
      if minibatch_size is not None:
          additional_options.dict_options[
              cntk_py.Learner._MINIBATCH_SIZE
          ] = cntk_py.SizeTWrapper(
              minibatch_size
          )  # need this to make proper typed DictionaryValue
  
      opt = cntk_py.adam_learner(
          parameters,
          lr,
          momentum,
          unit_gain,
          variance_momentum,
          epsilon,
          adamax,
          additional_options,
      )
      opt.is_minibatch_size_explicitly_specified = (
          minibatch_size is not None
      )
      return opt
  
imports: from enum import Enum, unique
  import warnings
  import numpy
  import cntk.internal.utils
  from ..None import cntk_py, NDArrayView, asarray
  from cntk.internal import typemap
  from ..internal.swig_helper import map_if_possible
label_desc: Use image node_id 22 for calling a global function with example usage: adam(parameters, lr, momentum, unit_gain, variance_momentum, l1_regularization_weight, l2_regularization_weight, gaussian_noise_injection_std_dev, gradient_clipping_threshold_per_sample, gradient_clipping_with_truncation, use_mean_gradient, epsilon, adamax, minibatch_size, epoch_size) and returns: opt