How to interpolate items of a tensor?

Hi! I have a tensor of shape (300x1024) containing a 1024 length codification of 300 frames
Some keyframes, one every 30 frames (frame 0,30,60…) is a keyframe.
I need to, for each code that doesn’t belong to a keyframe, to interpolate between the previous and next keyframe and set the result as the code for that frame
Any elegant solution to do this?

I guess interpolate would work if you select every 30th data point:

x = torch.randn(300, 1024) 

x = x[None, None]
out = torch.nn.functional.interpolate(x[:, ::30], size=(300, 1024))
out = out.squeeze()

thanks! that is what I was looking for!