(a, source, destination)
| 153 | # https://github.com/numpy/numpy/blob/d9b1e32cb8ef90d6b4a47853241db2a28146a57d/numpy/core/numeric.py#L1336-L1405 |
| 154 | @derived_from(np) |
| 155 | def 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: |
nothing calls this directly
no test coverage detected
searching dependent graphs…