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

Function _block

numpy/_core/shape_base.py:748–764  ·  view source on GitHub ↗

Internal implementation of block based on repeated concatenation. `arrays` is the argument passed to block. `max_depth` is the depth of nested lists within `arrays` and `result_ndim` is the greatest of the dimensions of the arrays in `arrays` and the depth of the lists in `array

(arrays, max_depth, result_ndim, depth=0)

Source from the content-addressed store, hash-verified

746
747
748def _block(arrays, max_depth, result_ndim, depth=0):
749 """
750 Internal implementation of block based on repeated concatenation.
751 `arrays` is the argument passed to
752 block. `max_depth` is the depth of nested lists within `arrays` and
753 `result_ndim` is the greatest of the dimensions of the arrays in
754 `arrays` and the depth of the lists in `arrays` (see block docstring
755 for details).
756 """
757 if depth < max_depth:
758 arrs = [_block(arr, max_depth, result_ndim, depth + 1)
759 for arr in arrays]
760 return _concatenate(arrs, axis=-(max_depth - depth))
761 else:
762 # We've 'bottomed out' - arrays is either a scalar or an array
763 # type(arrays) is not list
764 return _atleast_nd(arrays, result_ndim)
765
766
767def _block_dispatcher(arrays):

Callers 1

_block_concatenateFunction · 0.85

Calls 1

_atleast_ndFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…