MCPcopy Create free account
hub / github.com/dask/dask / broadcast_arrays

Function broadcast_arrays

dask/array/core.py:5385–5404  ·  view source on GitHub ↗
(*args, subok=False)

Source from the content-addressed store, hash-verified

5383
5384@derived_from(np)
5385def broadcast_arrays(*args, subok=False):
5386 subok = bool(subok)
5387
5388 to_array = asanyarray if subok else asarray
5389 args = tuple(to_array(e) for e in args)
5390
5391 # Unify uneven chunking
5392 inds = [list(reversed(range(x.ndim))) for x in args]
5393 uc_args = concat(zip(args, inds))
5394 _, args = unify_chunks(*uc_args, warn=False)
5395
5396 shape = broadcast_shapes(*(e.shape for e in args))
5397 chunks = broadcast_chunks(*(e.chunks for e in args))
5398
5399 if NUMPY_GE_200:
5400 result = tuple(broadcast_to(e, shape=shape, chunks=chunks) for e in args)
5401 else:
5402 result = [broadcast_to(e, shape=shape, chunks=chunks) for e in args]
5403
5404 return result
5405
5406
5407def offset_func(func, offset, *args):

Callers 2

ravel_multi_indexFunction · 0.90
meshgridFunction · 0.90

Calls 5

unify_chunksFunction · 0.85
broadcast_shapesFunction · 0.85
broadcast_chunksFunction · 0.85
broadcast_toFunction · 0.85
concatFunction · 0.50

Tested by

no test coverage detected