Which line of code is raising this error?
I would recommend to use a specific dim argument in squeeze, as otherwise you might be losing e.g. the batch dimension, if you are dealing with a single sample in a batch:
x = torch.squeeze(x)

I assume you would like to squeeze the temporal dimension here? If so, specify it with dim=temp_dim and retry your code again.