(*args, subok=False)
| 5383 | |
| 5384 | @derived_from(np) |
| 5385 | def 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 | |
| 5407 | def offset_func(func, offset, *args): |
no test coverage detected