I have to apply the following operations on a video (frame-wise)

RGB to grayscale
Center Crop
Color Normalize
Give the video (the sequence of the frames) as input to a model.

Moreover, I have to compute gradients over these operations later. I asked this Question 7 and was suggested to use Kornia 6 which supports gradients over these operations, which works well for me.
There is another problem though. The model expects an input of the shape (1, #frames, height, width) whereas the above operations expect the shape (#frames, #channels, height, width). So I need to apply reshape() operation, due to which I am unable to compute the gradients. Kindly provide me with a workaround or point out what am I doing wrong.