code: def get_support_shape(
      support_shape: Optional[
          Sequence[Union[int, np.ndarray, TensorVariable]]
      ],
      *,
      shape: Optional[Shape] = None,
      dims: Optional[Dims] = None,
      observed: Optional[Any] = None,
      support_shape_offset: Sequence[int] = None,
      ndim_supp: int = 1,
  ) -> Optional[TensorVariable]:
      """Extract the support shapes from shape / dims / observed information
  
      Parameters
      ----------
      support_shape:
          User-specified support shape for multivariate distribution
      shape:
          User-specified shape for multivariate distribution
      dims:
          User-specified dims for multivariate distribution
      observed:
          User-specified observed data from multivariate distribution
      support_shape_offset:
          Difference between last shape dimensions and the length of
          explicit support shapes in multivariate distribution, defaults to 0.
          For timeseries, this is shape[-1] = support_shape[-1] + 1
      ndim_supp:
          Number of support dimensions of the given multivariate distribution, defaults to 1
  
      Returns
      -------
      support_shape
          Support shape, if specified directly by user, or inferred from the last dimensions of
          shape / dims / observed. When two sources of support shape information are provided,
          a symbolic Assert is added to ensure they are consistent.
      """
      if ndim_supp < 1:
          raise NotImplementedError("ndim_supp must be bigger than 0")
      if support_shape_offset is None:
          support_shape_offset = [0] * ndim_supp
      elif isinstance(support_shape_offset, int):
          support_shape_offset = [support_shape_offset] * ndim_supp
      inferred_support_shape: Optional[
          Sequence[Union[int, np.ndarray, Variable]]
      ] = None
  
      if shape is not None:
          shape = to_tuple(shape)
          assert isinstance(shape, tuple)
          if len(shape) < ndim_supp:
              raise ValueError(
                  f"Number of shape dimensions is too small for ndim_supp of {ndim_supp}"
              )
          inferred_support_shape = [
              shape[i] - support_shape_offset[i]
              for i in np.arange(-ndim_supp, 0)
          ]
  
      if inferred_support_shape is None and dims is not None:
          dims = convert_dims(dims)
          assert isinstance(dims, tuple)
          if len(dims) < ndim_supp:
              raise ValueError(
                  f"Number of dims is too small for ndim_supp of {ndim_supp}"
              )
          model = modelcontext(None)
          inferred_support_shape = [
              model.dim_lengths[dims[i]] - support_shape_offset[i]  # type: ignore
              for i in np.arange(-ndim_supp, 0)
          ]
  
      if inferred_support_shape is None and observed is not None:
          observed = convert_observed_data(observed)
          if observed.ndim < ndim_supp:
              raise ValueError(
                  f"Number of observed dimensions is too small for ndim_supp of {ndim_supp}"
              )
          inferred_support_shape = [
              observed.shape[i] - support_shape_offset[i]
              for i in np.arange(-ndim_supp, 0)
          ]
  
      if inferred_support_shape is None:
          if support_shape is not None:
              # Only source of information was the originally provided support_shape
              inferred_support_shape = support_shape
          else:
              # We did not learn anything
              return None
      elif support_shape is not None:
          # There were two sources of support_shape, make sure they are consistent
          inferred_support_shape = [
              cast(
                  Variable,
                  Assert(
                      msg="support_shape does not match respective shape dimension"
                  )(inferred, pt.eq(inferred, explicit)),
              )
              for inferred, explicit in zip(
                  inferred_support_shape, support_shape
              )
          ]
  
      return pt.stack(inferred_support_shape)
  
imports: import warnings
  from functools import singledispatch
  from typing import Any, Optional, Sequence, Tuple, Union, cast
  import numpy
  from pytensor import config
  from pytensor import tensor
  from pytensor.graph.basic import Variable
  from pytensor.graph.op import Op, compute_test_value
  from pytensor.raise_op import Assert
  from pytensor.tensor.random.op import RandomVariable
  from pytensor.tensor.shape import SpecifyShape
  from pytensor.tensor.variable import TensorVariable
  from typing_extensions import TypeAlias
  from pymc.model import modelcontext
  from pymc.pytensorf import convert_observed_data
  from pymc.exceptions import ShapeError
  from pymc.pytensorf import PotentialShapeType
  from pymc.util import _add_future_warning_tag
label_desc: Use image node_id 14 for calling a global function with example usage: get_support_shape(support_shape) and returns: pt, None