MCPcopy Index your code
hub / github.com/numpy/numpy / _broadcast_shape

Function _broadcast_shape

numpy/lib/_stride_tricks_impl.py:520–534  ·  view source on GitHub ↗

Returns the shape of the arrays that would result from broadcasting the supplied arrays against each other.

(*args)

Source from the content-addressed store, hash-verified

518
519
520def _broadcast_shape(*args):
521 """Returns the shape of the arrays that would result from broadcasting the
522 supplied arrays against each other.
523 """
524 # use the old-iterator because np.nditer does not handle size 0 arrays
525 # consistently
526 b = np.broadcast(*args[:64])
527 # unfortunately, it cannot handle 64 or more arguments directly
528 for pos in range(64, len(args), 63):
529 # ironically, np.broadcast does not properly handle np.broadcast
530 # objects (it treats them as scalars)
531 # use broadcasting to avoid allocating the full array
532 b = broadcast_to(0, b.shape)
533 b = np.broadcast(b, *args[pos:(pos + 63)])
534 return b.shape
535
536
537_size0_dtype = np.dtype([])

Callers 3

test_broadcast_shapeFunction · 0.90
broadcast_shapesFunction · 0.85
broadcast_arraysFunction · 0.85

Calls 1

broadcast_toFunction · 0.85

Tested by 1

test_broadcast_shapeFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…