grids.mixins.core.GridUtilsMixin.broadcast_shapes_to_axes#

GridUtilsMixin.broadcast_shapes_to_axes(shapes: Sequence[int | Sequence[int]], axes_in: Sequence[AxesInput], axes_out: AxesInput) Sequence[Tuple[int, ...]][source]#

Broadcast multiple input shapes aligned to axes_in so they are compatible with axes_out.

This is a pluralized version of broadcast_shape_to_axes() that applies the same logic to a list of shapes and axis specifications.

Parameters:
  • shapes (sequence of shape-like) – A list of shapes, each of which corresponds to an input array. Each shape must be aligned with the axes provided in axes_in, possibly followed by additional non-grid dimensions (e.g., for vector or tensor components).

  • axes_in (sequence of AxesInput) – A list of axis specifications. Each entry describes the grid axes that the corresponding shape aligns to.

  • axes_out (AxesInput) – The target axes into which all shapes should be broadcast-compatible. Axes not present in an input are inserted as singleton dimensions (1).

Returns:

The broadcasted shapes, each of which is compatible with the axes_out layout.

Return type:

sequence of tuple[int, ]

Raises:

ValueError – If the number of input shapes and axis specs do not match, or if any axes_in are not a subset of axes_out.