code: def _to_constrained(
      value: TensorType, transform: Optional[Transform]
  ) -> TensorType:
      if transform is not None:
          return transform.forward(value)
      return value
  
imports: from enum import Enum
  from typing import TYPE_CHECKING, Any, List, Optional, Sequence, Tuple, Union
  import numpy
  import tensorflow
  import tensorflow_probability
  from check_shapes import check_shapes
  from typing_extensions import Final
  from .config import default_float, default_summary_fmt
  from .type_flags import GENERIC_NP_ARRAYS, NP_TYPE_CHECKING
label_desc: Use image node_id 5 for calling a global function with example usage: _to_constrained(value, transform) and returns: value, transform