-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a newsplit argument to transpose #71
Comments
My two cents on API design is that transpose should not move any actual data around, e.g., transpose on |
Thanks for the feedback @shoyer ! Transpose could behave as you described, it would mean changing the default as to where the split goes -- currently the default is to keep the split the same, you're suggesting a new split that keeps the same contents on either side. But your version would also in general require a swap via shuffle; there's no placement of the split that will make that transpose free, it'll only be free if transposing happens locally to the keys, or the values, or both. Great insight that people might expect One option would be to require manually specifying that Also, note that transpose is lazy even if it incurs a swap, which means it will get combined with downstream distributed operations and executed all at once. |
Maybe the bolt array data model should use an explicit list of axes in the key, rather than a split? That would let you guarantee that operations like transpose never need to move around data. Xray will actually transpose automatically to align named axes in binary operations, so we do this sort of thing a lot. |
Another reason to consider splitting along an explicit set of axes would be because the notion of axis order is not so well defined for some xray objects (datasets can have arrays with different dimensions and axis orders). I do understand how a split makes sense in the context of broadcasting operations, because the last axes (where broadcasting starts) are not the distributed ones. |
Currently,
transpose
is significantly less general thanswap
because it keeps the thesplit
the same. For example, if we want to go from a(1000) x (500,500)
array to a(500,500) x (1000)
array, we can do that with aswap
viaswap((0),(0,1))
, but with transpose we can only get to(500) x (500,1000)
viatranspose(2,1,0)
.If
transpose
supported anewsplit
or similar keyword arg, we could get to the same result withtranspose
, which is often more intuitive than callingswap
directly.cc @jwittenbach
The text was updated successfully, but these errors were encountered: