You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / _core / shape_base / _block_check_depths_match

function

numpy._core.shape_base:_block_check_depths_match

source: /numpy/_core/shape_base.py :557

Signature

def   _block_check_depths_match ( arrays parent_index = [] )

Summary

Recursive function checking that the depths of nested lists in arrays all match. Mismatch raises a ValueError as described in the block docstring below.

Extended Summary

The entire index (rather than just the depth) needs to be calculated for each innermost list, in case an error needs to be raised, so that the index of the offending list can be printed as part of the error.

Parameters

arrays : nested list of arrays

The arrays to check

parent_index : list of int

The full index of arrays within the nested lists passed to _block_check_depths_match at the top of the recursion.

Returns

first_index : list of int

The full index of an element from the bottom of the nesting in arrays. If any element at the bottom is an empty list, this will refer to it, and the last index along the empty axis will be None.

max_arr_ndim : int

The maximum of the ndims of the arrays nested in arrays.

: final_size: int

The number of elements in the final array. This is used the motivate the choice of algorithm used using benchmarking wisdom.

Aliases

  • numpy._core.shape_base._block_check_depths_match