code: def broadcast_static_dim_lengths(
      dim_lengths: Sequence[Union[int, None]],
  ) -> Union[int, None]:
      """Apply static broadcast given static dim length of inputs (obtained from var.type.shape).
  
      Raises
      ------
      ValueError
          When static dim lengths are incompatible
      """
  
      dim_lengths_set = set(dim_lengths)
      # All dim_lengths are the same
      if len(dim_lengths_set) == 1:
          return tuple(dim_lengths_set)[0]
  
      # Only valid indeterminate case
      if dim_lengths_set == {None, 1}:
          return None
  
      dim_lengths_set.discard(1)
      dim_lengths_set.discard(None)
      if len(dim_lengths_set) > 1:
          raise ValueError
      return tuple(dim_lengths_set)[0]
  
file_path: pytensor/pytensor/tensor/utils.py
imports: import re
  from collections.abc import Sequence
  from typing import Union
  import numpy
  import pytensor
  from pytensor.utils import hash_from_code
label_desc: Use image node_id 5 for calling a global function with example usage: broadcast_static_dim_lengths(dim_lengths) and returns: tuple, tuple, None