The older version produced a flattened version of the input tensor including batch dimension.
Specifically, given the 'pool5' output tensor of VGG16 net, i.e. batch_size x 512 x 7 x 7:
older version (Lambda(lambda x,s=torch.Size([-1]): x.view(s))): batch_size 512 7 * 7
new version (Lambda(lambda x: x.view(x.size(0),-1))): batch_size x 512 7 7
The older version produced a flattened version of the input tensor including batch dimension. Specifically, given the 'pool5' output tensor of VGG16 net, i.e. batch_size x 512 x 7 x 7:
Thank you for your script