Skip to content

Will muti-level bracket be supported in rearragement in the future version? #272

Answered by boeddeker
wzm2256 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

you could use a single bracket.
There is no difference between (a b c), (a (b c)) and ((a b) c).
Only the letter order is important, not the execution order.

import torch
import einops
A=torch.randn(1, 32,32)
B = einops.rearrange(einops.rearrange(A, 'a b c -> a (b c)'), 'a d -> (a d)')
C = einops.rearrange(A, 'a b c -> (a b c)')
torch.testing.assert_close(B, C)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@wzm2256
Comment options

Answer selected by wzm2256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants