code: def change_dist_size(
      dist: TensorVariable,
      new_size: PotentialShapeType,
      expand: bool = False,
  ) -> TensorVariable:
      """Change or expand the size of a Distribution.
  
      Parameters
      ----------
      dist:
          The old distribution to be resized.
      new_size:
          The new size of the distribution.
      expand: bool, optional
          If True, `new_size` is prepended to the existing distribution `size`, so that
          the final size is equal to (*new_size, *dist.size). Defaults to false.
  
      Returns
      -------
      dist : TensorVariable
          A new distribution variable that is equivalent to the original distribution with
          the new size. The new distribution will not reuse the old RandomState/Generator
          input, so it will be independent from the original distribution.
  
      Examples
      --------
      .. code-block:: python
  
          x = Normal.dist(shape=(2, 3))
          new_x = change_dist_size(x, new_size=(5, 3), expand=False)
          assert new_x.eval().shape == (5, 3)
  
          new_x = change_dist_size(x, new_size=(5, 3), expand=True)
          assert new_x.eval().shape == (5, 3, 2, 3)
  
      """
      # Check the dimensionality of the `new_size` kwarg
      new_size_ndim = np.ndim(new_size)  # type: ignore
      if new_size_ndim > 1:
          raise ShapeError(
              "The `new_size` must be ≤1-dimensional.",
              actual=new_size_ndim,
          )
      elif new_size_ndim == 0:
          new_size = (new_size,)  # type: ignore
      else:
          new_size = tuple(new_size)  # type: ignore
  
      new_dist = _change_dist_size(
          dist.owner.op, dist, new_size=new_size, expand=expand
      )
      _add_future_warning_tag(new_dist)
  
      new_dist.name = dist.name
      for k, v in dist.tag.__dict__.items():
          new_dist.tag.__dict__.setdefault(k, v)
  
      if config.compute_test_value != "off":
          compute_test_value(new_dist)
  
      return new_dist
  
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 11 for calling a global function with example usage: change_dist_size(dist, new_size, expand) and returns: new_dist