MCPcopy Index your code
hub / github.com/dask/dask / moveaxis

Function moveaxis

dask/array/numpy_compat.py:155–170  ·  view source on GitHub ↗
(a, source, destination)

Source from the content-addressed store, hash-verified

153# https://github.com/numpy/numpy/blob/d9b1e32cb8ef90d6b4a47853241db2a28146a57d/numpy/core/numeric.py#L1336-L1405
154@derived_from(np)
155def moveaxis(a, source, destination):
156 source = normalize_axis_tuple(source, a.ndim, "source")
157 destination = normalize_axis_tuple(destination, a.ndim, "destination")
158 if len(source) != len(destination):
159 raise ValueError(
160 "`source` and `destination` arguments must have "
161 "the same number of elements"
162 )
163
164 order = [n for n in range(a.ndim) if n not in source]
165
166 for dest, src in sorted(zip(destination, source)):
167 order.insert(dest, src)
168
169 result = a.transpose(order)
170 return result
171
172
173# Implementation adapted directly from numpy:

Callers

nothing calls this directly

Calls 1

transposeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…