def chunks_from_arrays(arrays):
    if not arrays:
        return ()
    result = []
    dim = 0

    def shape(x):
        try:
            return x.shape
        except AttributeError:
            return (1,)

    while isinstance(arrays, (list, tuple)):
        result.append(tuple(shape(deepfirst(a))[dim] for a in arrays))
        arrays = arrays[0]
        dim += 1
    return tuple(result)
Chunks tuple from nested list of arrays
dataset/ETHPy150Open dask/dask/dask/array/core.py/chunks_from_arrays