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

Function atleast_nd

dask/array/core.py:4544–4550  ·  view source on GitHub ↗
(x, ndim)

Source from the content-addressed store, hash-verified

4542 # or NUMPY_LICENSE.txt within this directory
4543
4544 def atleast_nd(x, ndim):
4545 x = asanyarray(x)
4546 diff = max(ndim - x.ndim, 0)
4547 if diff == 0:
4548 return x
4549 else:
4550 return x[(None,) * diff + (Ellipsis,)]
4551
4552 def format_index(index):
4553 return "arrays" + "".join(f"[{i}]" for i in index)

Callers 1

blockFunction · 0.85

Calls 2

maxFunction · 0.90
asanyarrayFunction · 0.70

Tested by

no test coverage detected