question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add rollaxis and moveaxis

See original GitHub issue

Would be nice to have Dask Array implementations of rollaxis and moveaxis. This can probably be done relatively easily by building off of transpose.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
shoyercommented, Jul 27, 2017

I’m just wondering do the docs spell this out somewhere? Ideally the API description would say this, but I’m not seeing it. Am thinking about this from the perspective of a C/C++ programmer where the docs really are the gold standard about what the library does.

Agreed, see https://github.com/numpy/numpy/issues/9476.

1reaction
shoyercommented, Jul 27, 2017

These functions already work on dask arrays, since they are defined in terms of the transpose method:

In [1]: import numpy as np

In [2]: import dask.array as da

In [3]: x = da.ones((10, 11, 12), chunks=7)

In [4]: np.rollaxis(x, 0, -1)
Out[4]: dask.array<transpose, shape=(11, 10, 12), dtype=float64, chunksize=(7, 7, 7)>

In [5]: np.moveaxis(x, 0, -1)
Out[5]: dask.array<transpose, shape=(11, 12, 10), dtype=float64, chunksize=(7, 7, 7)>

So we could probably just add appropriate aliases here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

numpy.rollaxis — NumPy v1.24 Manual
The moveaxis function was added in NumPy 1.11. Parameters: andarray. Input array. axisint. The axis to be ...
Read more >
NumPy: rollaxis() function - w3resource
The moveaxis function was added in NumPy 1.11. Syntax: numpy.rollaxis(a, source, destination) NumPy manipulation: rollaxis() function.
Read more >
Reason why numpy rollaxis is so confusing? - Stack Overflow
NumPy v1.11 and newer includes a new function, moveaxis , that I recommend using instead of rollaxis (disclaimer: I wrote it!). The source...
Read more >
[numpy Basic]rollaxis moveaxis swapaxes - Kaggle
Roll the specified axis backwards, until it lies in a given position. This function continues to be supported for backward compatibility, but you...
Read more >
cupy.rollaxis — CuPy 11.4.0 documentation
cupy.copyto · cupy.shape · cupy.reshape · cupy.ravel · cupy.moveaxis; cupy.rollaxis; cupy.swapaxes · cupy.transpose · cupy.atleast_1d · cupy.atleast_2d ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found