-
Hi again,
In this example, I have to use two rearrangement twice, and I need to use one more index 'd', which is not intuitive. In practice, the situation can be much more complicated. |
Beta Was this translation helpful? Give feedback.
Answered by
boeddeker
Jul 20, 2023
Replies: 1 comment 1 reply
-
Hi, you could use a single bracket. 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) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
wzm2256
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.