You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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".
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 to einops._rearrange and then have the new einops.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:
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
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: