-
Notifications
You must be signed in to change notification settings - Fork 336
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
How do I reverse rearrange with ellipsis composed? e.g. "b ... -> b (...)" #219
Labels
question
Further information is requested
Comments
implicit storage of information for reversal has flaws, and you already figured some of them I've implemented this:
|
👍 that's a good example @lucidrains PS: now I remember I actually encountered a number of cases when I wanted to apply sklearn models to tensors not matrices. |
arogozhnikov
changed the title
[Feature suggestion] Easy inverse for "rearrange" (with code suggestion)
How do I reverse rearrange with ellipsis composed? e.g. "b ... -> b (...)"
Jan 24, 2024
arogozhnikov
added
question
Further information is requested
and removed
feature suggestion
labels
Jan 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Francois Fleuret suggested that it'd be nice if there were an function whereby
einops.rearrange
could be easily 'inverted' i.e. undone or "transformed back".I replied that a "wrapper" function or class shouldn't be too hard, and wrote one at the following link, which includes a few examples:
https://gist.github.com/drscotthawley/81865a5c5e729b769486efb9c3f2249d
Whether such a functionality just remains as an "external wrapper" that users can add-on, or somehow gets added to the
einops
codebase (maybe not as this class, but something similar) is up to you, but wanted to share it here to add to the conversation!One way to include it into the existing codebase could be to rename
einops.rearrange
toeinops._rearrange
and then have the neweinops.rearrange =RearrangeWrapper()
where RearrangeWrapper's sub-methods call_rearrange
(as shown in my gist example). If that sounds interesting then I could submit a PR.The text was updated successfully, but these errors were encountered: