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

Function atleast_nd

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

Source from the content-addressed store, hash-verified

4337 # or NUMPY_LICENSE.txt within this directory
4338
4339 def atleast_nd(x, ndim):
4340 x = asanyarray(x)
4341 diff = max(ndim - x.ndim, 0)
4342 if diff == 0:
4343 return x
4344 else:
4345 return x[(None,) * diff + (Ellipsis,)]
4346
4347 def format_index(index):
4348 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