MCPcopy Create free account
hub / github.com/dask/dask / block

Function block

dask/array/core.py:4246–4413  ·  view source on GitHub ↗

Assemble an nd-array from nested lists of blocks. Blocks in the innermost lists are concatenated along the last dimension (-1), then these are concatenated along the second-last dimension (-2), and so on until the outermost list is reached Blocks can be of any dimension, but w

(arrays, allow_unknown_chunksizes=False)

Source from the content-addressed store, hash-verified

4244
4245
4246def block(arrays, allow_unknown_chunksizes=False):
4247 """
4248 Assemble an nd-array from nested lists of blocks.
4249
4250 Blocks in the innermost lists are concatenated along the last
4251 dimension (-1), then these are concatenated along the second-last
4252 dimension (-2), and so on until the outermost list is reached
4253
4254 Blocks can be of any dimension, but will not be broadcasted using the normal
4255 rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim``
4256 the same for all blocks. This is primarily useful for working with scalars,
4257 and means that code like ``block([v, 1])`` is valid, where
4258 ``v.ndim == 1``.
4259
4260 When the nested list is two levels deep, this allows block matrices to be
4261 constructed from their components.
4262
4263 Parameters
4264 ----------
4265 arrays : nested list of array_like or scalars (but not tuples)
4266 If passed a single ndarray or scalar (a nested list of depth 0), this
4267 is returned unmodified (and not copied).
4268
4269 Elements shapes must match along the appropriate axes (without
4270 broadcasting), but leading 1s will be prepended to the shape as
4271 necessary to make the dimensions match.
4272
4273 allow_unknown_chunksizes: bool
4274 Allow unknown chunksizes, such as come from converting from dask
4275 dataframes. Dask.array is unable to verify that chunks line up. If
4276 data comes from differently aligned sources then this can cause
4277 unexpected results.
4278
4279 Returns
4280 -------
4281 block_array : ndarray
4282 The array assembled from the given blocks.
4283
4284 The dimensionality of the output is equal to the greatest of:
4285 * the dimensionality of all the inputs
4286 * the depth to which the input list is nested
4287
4288 Raises
4289 ------
4290 ValueError
4291 * If list depths are mismatched - for instance, ``[[a, b], c]`` is
4292 illegal, and should be spelt ``[[a, b], [c]]``
4293 * If lists are empty - for instance, ``[[a, b], []]``
4294
4295 See Also
4296 --------
4297 concatenate : Join a sequence of arrays together.
4298 stack : Stack arrays in sequence along a new dimension.
4299 hstack : Stack arrays in sequence horizontally (column wise).
4300 vstack : Stack arrays in sequence vertically (row wise).
4301 dstack : Stack arrays in sequence depth wise (along third dimension).
4302 vsplit : Split array into a list of multiple sub-arrays vertically.
4303

Callers 3

tileFunction · 0.90
pad_reuseFunction · 0.90
pad_statsFunction · 0.90

Calls 7

_RecurserClass · 0.90
maxFunction · 0.90
format_indexFunction · 0.85
atleast_ndFunction · 0.85
map_reduceMethod · 0.80
concatenateFunction · 0.70
walkMethod · 0.45

Tested by

no test coverage detected