Rearrange to reshape and permute? #218
-
Hi I am learning how to use einops with https://einops.rocks/pytorch-examples.html I have a question how to convert this |
Beta Was this translation helpful? Give feedback.
Answered by
arogozhnikov
Oct 19, 2022
Replies: 1 comment 1 reply
-
Hi @camenduru You can think of it in steps: # first transpose: b c h w -> b h w c
x = x.transpose([0, 2, 3, 1])
# then compose two axes into one: b h w c-> b (h w) c
b, h, w, c = x.shape
x = x.reshape([b, h * w, c]) stackoverflow is the right place for such questions |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
camenduru
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @camenduru
You can think of it in steps:
stackoverflow is the right place for such questions