code: def constant(scalar, time):
      """Returns the given ``scalar``, for use in defining a :class:`~.ParametrizedHamiltonian` with a
      trainable coefficient.
  
      Args:
          scalar (float): the scalar to be returned
          time (float): Time. This argument is not used, but is required to match the call
              signature of :class:`~.ParametrizedHamiltonian`.
      Returns:
          float: The input ``scalar``.
  
      This function is mainly used to build a :class:`~.ParametrizedHamiltonian` that can be differentiated
      with respect to its time-independent term. It is an alias for ``lambda scalar, t: scalar``.
  
      **Example**
  
      The ``constant`` function can be used to create a parametrized Hamiltonian
  
      >>> H = qml.pulse.constant * qml.PauliX(0)
  
      When calling the parametrized Hamiltonian, ``constant`` will always return the input parameter
  
      >>> params = [5]
      >>> H(params, t=8)
      5*(PauliX(wires=[0]))
  
      >>> H(params, t=5)
      5*(PauliX(wires=[0]))
  
      We can differentiate the parametrized Hamiltonian with respect to the constant parameter:
  
      .. code-block:: python
  
          dev = qml.device("default.qubit.jax", wires=1)
          @qml.qnode(dev, interface="jax")
          def circuit(params):
              qml.evolve(H)(params, t=2)
              return qml.expval(qml.PauliZ(0))
  
  
      >>> params = jnp.array([5.0])
      >>> circuit(params)
      Array(0.40808904, dtype=float32)
  
      >>> jax.grad(circuit)(params)
      Array([-3.6517754], dtype=float32)
      """
      return scalar
  
imports: from typing import Callable, List, Tuple, Union
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: constant(scalar, time) and returns: scalar