code: def broadcast_params(params, ndims_params):
      """Broadcast parameters that have different dimensions.
  
      >>> ndims_params = [1, 2]
      >>> mean = np.array([1, 2, 3])
      >>> cov = np.stack([np.eye(3), np.eye(3)])
      >>> params = [mean, cov]
      >>> res = broadcast_params(params, ndims_params)
      [array([[1, 2, 3]]),
      array([[[1., 0., 0.],
               [0., 1., 0.],
               [0., 0., 1.]],
              [[1., 0., 0.],
               [0., 1., 0.],
               [0., 0., 1.]]])]
  
      Parameters
      ==========
      params : list of ndarray
          The parameters to broadcast.
      ndims_params : list of int
          The expected number of dimensions for each element in `params`.
  
      Returns
      =======
      bcast_params : list of ndarray
          The broadcasted values of `params`.
      """
      use_pytensor = False
      param_shapes = []
      for p in params:
          param_shape = tuple(
              1 if bcast else s
              for s, bcast in zip(
                  p.shape,
                  getattr(p, "broadcastable", (False,) * p.ndim),
              )
          )
          use_pytensor |= isinstance(p, Variable)
          param_shapes.append(param_shape)
  
      shapes = params_broadcast_shapes(
          param_shapes, ndims_params, use_pytensor=use_pytensor
      )
      broadcast_to_fn = (
          broadcast_to if use_pytensor else np.broadcast_to
      )
  
      bcast_params = [
          broadcast_to_fn(param, shape)
          for shape, param in zip(shapes, params)
      ]
  
      return bcast_params
  
imports: from collections.abc import Sequence
  from functools import wraps
  from itertools import zip_longest
  from types import ModuleType
  from typing import TYPE_CHECKING, Literal, Optional, Union
  import numpy
  from pytensor.compile.sharedvalue import shared
  from pytensor.graph.basic import Constant, Variable
  from pytensor.scalar import ScalarVariable
  from pytensor.tensor import get_vector_length
  from pytensor.tensor.basic import as_tensor_variable, cast, constant
  from pytensor.tensor.extra_ops import broadcast_to
  from pytensor.tensor.math import maximum
  from pytensor.tensor.shape import specify_shape
  from pytensor.tensor.type import int_dtypes
  from pytensor.tensor.variable import TensorVariable
label_desc: Use image node_id 2 for calling a global function with example usage: broadcast_params(params, ndims_params) and returns: bcast_params