code: def lower_bound(
      x: Tensor,
      bound: Union[float, Tensor],
      gradient: str = "identity_if_towards",
  ) -> Tensor:
      """``torch.maximum`` with a gradient for :math:`x < bound`.
  
      This function is semantically equivalent to ``torch.maximum`` except the
      behavior of the gradient with respect to :math:`x` for input values that
      reach the :math:`bound` depends on the ``gradient`` option:
  
          * ``"disconnected"``, the returned gradient is zero for values that
            reach the :math:`bound`. This behavior is identical to the behavior
            of ``torch.maximum``.
  
          * ``"identity"``, the gradient is unconditionally replaced with the
            identity function.
  
          * ``"identity_if_towards"``, the gradient is replaced with the identity
            function, but only if applying gradient descent would push the values
            of inputs towards the :math:`bound`. For gradient values that push
            away from the :math:`bound`, the returned gradient is still zero.
  
      In the latter two cases, ``"identity"`` and ``"identity_if_towards"``, no
      gradient is returned for :math:`bound`. Also, the implementation of
      ``"identity_if_towards"`` assumes the shape of :math:`x` is the same as the
      shape of the output (i.e. it won’t work reliably for all possible
      broadcasting scenarios).
  
      Args:
          x: the input tensor.
          bound: upper bound for :math:`x`.
          gradient: The gradient to use. One of {``"disconnected"``,
              ``"identity"``, ``"identity_if_towards"``}. Defaults to
              ``"identity_if_towards"``.
  
      Returns:
          the output tensor.
      """
  
      if gradient not in (
          "disconnected",
          "identity",
          "identity_if_towards",
      ):
          raise ValueError
  
      return _LowerBound.apply(
          x,
          bound,
          _LowerBoundGradient[gradient].value,
      )
  
file_path: NeuralCompression/neuralcompression/functional/_lower_bound.py
imports: import enum
  from enum import IntEnum
  from typing import Union
  import torch
  import torch.nn
  from torch import Tensor
  from torch.autograd import Function
label_desc: Use image node_id 1 for calling a global function with example usage: lower_bound(x, bound, gradient) and returns: _LowerBound