Rearrange a 5D tensor using einops
I am analyzing the implementation of the ViViT: A Video Vision Transformer. The input tensor of this model has the sahpe of (batch size, num frames, channels=3, H, W). When it comes to patch embedding, it uses the Rearrange  that is imported from from einops.layers.torch import Rearrange as follows:
  self.to_patch_embedding = nn.Sequential(
            Rearrange('b t c (h p1) (w p2) -&gt; b t (h w) (p1 p2 c)', p1 = patch_size, p2 = patch_size),
            nn.Linear(patch_dim, dim),
        )

My question is that what will be happened to the input tensor [b, t,c,h,w] by the Rearrange function. This is because although I read the paper but it still is ambiguous for me?
Any help is welcome.

Suppose there is an input tensor of shape (32, 10, 3, 32, 32) representing (batchsize, num frames, channels, height, width).
b t c (h p1) (w p2) with p1=2 and p2=2 decomposes the tensor to (32, 10, 3, (16, 2), (16, 2))
b t (h w) (p1 p2 c) composes the decomposed the tensor to (32, 10, 32*32=1024, 2*2*3=12)
