code: def momentum_as_time_constant_schedule(momentum, epoch_size=None):
      """
      Create a momentum schedule in a minibatch-size agnostic way
      (using the same semantics as :func:`training_parameter_schedule`
      with `unit=UnitType.sample`).
  
      Deprecated:: 2.2
          This is for legacy API.
          In this legacy API,::
  
              #assume the desired minibatch size invariant constant momentum rate is: momentum_rate
              momentum_time_constant = -minibatch_size/np.log(momentum_rate)
              momentum = momentum_as_time_constant_schedule(momentum_time_constant)
  
          The equivalent code in the latest API, ::
  
              momentum = momentum_schedule(momentum_rate, minibatch_size = minibatch_size)
  
  
      Args:
          momentum (float or list): see parameter ``schedule`` in
           :func:`training_parameter_schedule`.
          epoch_size (int): see parameter ``epoch_size`` in
           :func:`training_parameter_schedule`.
  
      CNTK specifies momentum in a minibatch-size agnostic way as the time
      constant (in samples) of a unit-gain 1st-order IIR filter. The value
      specifies the number of samples after which a gradient has an effect of
      1/e=37%.
  
      If you want to specify the momentum per N samples (or per minibatch),
      use :func:`momentum_schedule`.
  
      Examples:
          >>> # Use a fixed momentum of 1100 for all samples
          >>> m = momentum_as_time_constant_schedule(1100)
  
          >>> # Use the time constant 1100 for the first 1000 samples,
          >>> # then 1500 for the remaining ones
          >>> m = momentum_as_time_constant_schedule([1100, 1500], 1000)
  
      Returns:
          momentum as time constant schedule
      """
      if isinstance(
          momentum, (cntk_py.training_double_parameter_schedule)
      ):
          # the legacy momentum as time constant schedule: the ref minibatch size is always 1, so it is specified by definition
          momentum.is_minibatch_size_explicitly_specified = True
          return momentum
  
      if isinstance(momentum, (int, float)):
          if epoch_size is not None:
              warnings.warn(
                  "When providing the schedule as a number, epoch_size is ignored",
                  RuntimeWarning,
              )
          momentum = cntk_py.momentum_as_time_constant_schedule(
              momentum
          )
          momentum.is_minibatch_size_explicitly_specified = True
          return momentum
  
      epoch_size = (
          epoch_size
          if epoch_size is not None
          else cntk_py.training_double_parameter_schedule.full_data_sweep
      )
      if isinstance(momentum, list):
          momentum = _prepare_training_parameter_list(momentum)
          args = [
              momentum,
              epoch_size,
              1,
          ]  # momentum constant schedule's reference minibatch size is always per sample
          momentum = cntk_py.training_double_parameter_schedule(*args)
          momentum = cntk_py.momentum_as_time_constant_schedule(
              momentum
          )
          momentum.is_minibatch_size_explicitly_specified = True
          return momentum
  
      raise ValueError(
          "momentum must be either a float or a list, not %s"
          % type(momentum)
      )
  
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 12 for calling a global function with example usage: momentum_as_time_constant_schedule(momentum, epoch_size) and returns: momentum, momentum, momentum