Replies: 4 comments 1 reply
-
Thanks for kind words. Torch some time ago committed to support array api standard, but I don't see much progress on their side recently: Whether this should be considered 'won't do' - I don't know, but currently eindex does not work for torch. |
Beta Was this translation helpful? Give feedback.
-
actually, maybe https://github.com/data-apis/array-api-compat can solve the issue, haven't tried |
Beta Was this translation helpful? Give feedback.
-
Thanks for explaining the situation with standard array api.
Sorry, did you mean then "does NOT work for torch"? |
Beta Was this translation helpful? Give feedback.
-
I was delighted to stumble upon this work while digging through feature requests on einops. I would love to see Is it known whether they are interested to implement? This would facilitate research into gating strategies. Yesterday I was trying to do what should be a very simple operation: Given a vector of offsets I was not happy with the look of the result: splitter_indices = (λ >= 0).long() # (nBatch, nHidden)
# (2, nHidden, nOut)
splitter_indices_expanded = splitter_indices.unsqueeze(-1).expand(-1, -1, nOut)
# self.Y: (2, nHidden, nOut)
selected_Y = torch.gather(self.Y, 0, splitter_indices_expanded)
scaled_chosen_Ys = λλ.unsqueeze(-1) * selected_Y It is the opposite of "Pythonic" -- quite impossible for me myself to read without having to apply some unpleasant mental contortion every time I look at it. I simply want to get So I'd be hoping to write something along the vague lines of: Or
I find myself at a point of considering looking at Julia for prototyping designs. I tried playing with it when it came out, and found it to be rather fierce. But this seems to be an intrinsically fierce game. It gets to the point where it's questionable whether to even seek a clean Python implementation, or put up with ugly (and heavily commented) prototypes and write clean C++/CUDA once something works. I do hope team PyTorch give this library the attention it deserves. |
Beta Was this translation helpful? Give feedback.
-
Hi,
This looks great! I am struggling with indexing every time. Previously I was able to utilize gather to do what was needed, but now I need something like:
out[i,j,k] = in[j,k,idx[i,j]]
which I have no idea how to implement (thinking of gather with expanding both in and idx). Your notation would be so transparent and helpful! Perhaps I missed something, do you already have some functionality for pytorch? Or what do the perspectives look like?
Beta Was this translation helpful? Give feedback.
All reactions