I have a tensor in size of (BTCHW) in which B is the batch size, T is the number of frames of the video, C the number of channels, and H,W the spatial size. This tensor is the extracted feature map of testing some videos on a pre-trained network. As the number of frames may vary from a video to another I wanted to interpolate all of the possible tensors to have the same temporal size.
features_m = F.upsample(features_m, 128, mode=‘linear’)
but it didn’t work. The size of the tensors only may vary in their second dimension. I want them to all have 128 timesteps. Would you guide me on how to do it?
You could permute the dimensions and use the temporal dimension as a “fake” spatial dimension.
Afterwards you could permute it back to the original shape.
Let me know, if this would work for you.
Thanks, yes it works.