I’m working with a sequence sampled at 2KHz, but I need to downsample it to 10Hz. I’ve reshaped the sequence to match the input shape of a GRU layer, (seq_len, batch, input_size)
but when I try to use torch.nn.functional.interpolate
, it seems that the function is trying to downsample the last dimension. My input_size
is 16, corresponding to the 16 sensors the data has been collected from. I want to do a temporal interpolation on the first dimension instead.
I couldn’t find any direct solutions and ended up permuting the dimensions. For anyone that ends up here, this is how I did the downsampling:
F.interpolate(input.permute(1, 2, 0), scale_factor=..., mode=...).permute(2, 0, 1)
The output can now be fed into modules like GRU.