# Reference - einops [[Code](https://github.com/arogozhnikov/einops)] [[Docs](https://einops.rocks/)] - [PyTorch 70.einops:优雅地操作张量维度](https://zhuanlan.zhihu.com/p/342675997) - # Brief - rearrange - reduce - repeat  ## UseCase UseCase | Code |Original | After -- | -- | :--: | :--: rearrange | `rearrange(ims[0], 'h w c -> w h c')` |  |  ... | `rearrange(ims, 'b h w c -> (b h) w c')` |  |  ... | `rearrange(ims, 'b h w c -> (b h w c)').shape` | (6, 96, 96, 3) | (165888,) reduce | `reduce(ims, 'b h w c -> h w c', 'mean')` | | 
Reference
Brief
UseCase
rearrange(ims[0], 'h w c -> w h c')rearrange(ims, 'b h w c -> (b h) w c')rearrange(ims, 'b h w c -> (b h w c)').shapereduce(ims, 'b h w c -> h w c', 'mean')