bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / broadcast_arrays
_ArrayFunctionDispatcher
numpy:broadcast_arrays
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_stride_tricks_impl.py :514
Signature
def broadcast_arrays ( * args , subok = False ) Summary
Broadcast any number of arrays against each other.
Parameters
*args: array_likesThe arrays to broadcast.
subok: bool, optionalIf True, then sub-classes will be passed-through, otherwise the returned arrays will be forced to be a base-class array (default).
Returns
broadcasted: tuple of arraysThese arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first. While you can set the
writableflag True, writing to a single output value may end up changing more than one location in the output array.
Examples
import numpy as np x = np.array([[1,2,3]]) y = np.array([[4],[5]])✓
np.broadcast_arrays(x, y)
✗[np.array(a) for a in np.broadcast_arrays(x, y)]
✗See also
- broadcast
- broadcast_shapes
- broadcast_to
Aliases
-
numpy.broadcast_arrays