Pytorch: turning a [1,x] sized tensor into an [x] sized tensor
While trying to load in Pytorch 0.4.0 a model that has probably been produced by Pytorch 0.3.1, I keep getting such errors:

While copying the parameter named "conv1_7x7_s2_bn.bias", whose dimensions in the
model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([1, 64]).


I thought that if I had applied transpose on each tensor, then it would work, but it is still failing, as the dimension turns into [64, 1], rather than [64], which I need.

I can I remove the redundant dimension and thus turn the 1-row matrix into a vector?

Note: When calling torch.flatten, I get: 

AttributeError: module 'torch' has no attribute 'flatten'


Removing empty dimensions is called "squeezing". NumPy does it, Tensorflow does it and PyTorch does it.

So the correct command is:

torch.squeeze(tensor)

