code: def _update_dim_sizes(
      dim_sizes: dict[str, int],
      shape: tuple[int, ...],
      core_dims: CoreDims,
      error_context: str = "",
      *,
      is_input: bool,
  ):
      """Incrementally check and update core dimension sizes for a single argument.
  
      Args:
        dim_sizes: sizes of existing core dimensions. Will be updated in-place.
        shape: shape of this argument.
        core_dims: core dimensions for this argument.
        error_context: string context for error messages.
        is_input: are we parsing input or output arguments?
      """
      num_core_dims = len(core_dims)
      if is_input:
          if len(shape) < num_core_dims:
              raise ValueError(
                  "input with shape %r does not have enough dimensions for all core "
                  "dimensions %r %s" % (shape, core_dims, error_context)
              )
      else:
          if len(shape) != num_core_dims:
              raise ValueError(
                  "output shape %r does not match core dimensions %r %s"
                  % (shape, core_dims, error_context)
              )
  
      core_shape = shape[-num_core_dims:] if core_dims else ()
      for dim, size in zip(core_dims, core_shape):
          if dim not in dim_sizes:
              dim_sizes[dim] = size
          elif size != dim_sizes[dim]:
              raise ValueError(
                  "inconsistent size for core dimension %r: %r vs %r %s"
                  % (dim, size, dim_sizes[dim], error_context)
              )
  
file_path: jax/jax/_src/numpy/vectorize.py
imports: from __future__ import annotations
  from collections.abc import Collection, Sequence
  import functools
  import re
  from typing import Any, Callable
  from jax._src import api
  from jax import lax
  from jax._src.numpy import lax_numpy
  from jax._src.util import safe_map, safe_zip
label_desc: Use image node_id 2 for calling a global function with example usage: _update_dim_sizes(dim_sizes, shape, core_dims, error_context) without return types