def broadcast_like(
      self, other: NamedArrayBase | jax.typing.ArrayLike
  ) -> NamedArrayBase:
    """Broadcasts a named array to be compatible with another.

    Args:
      other: Another named array.

    Returns:
      A named array that has the same positional and named shapes as ``other``
      (although it may also include extra named axes).
    """
    if isinstance(other, NamedArrayBase):
      return self.broadcast_to(other.positional_shape, other.named_shape)
    else:
      shape = jnp.shape(other)
      return self.broadcast_to(shape, {})
Broadcasts a named array to be compatible with another.

    Args:
      other: Another named array.

    Returns:
      A named array that has the same positional and named shapes as ``other``
      (although it may also include extra named axes).
    
penzai/core/named_axes.py