I am dealing with variable sized inputs to a CNN and I wanted to know how to feed it to a last FC layer to satisfy the requirement for the CrossEntropy Loss function. Even if taken care for one sample, the subsequent sample would have different dimensions and can't be used in backpropagation. So I wanted to know a way or different ways this can be handled.
(P.S : Cropping the input to make it fixed size is being currently used and the query is for improvising)
Just place torch.nn.AdaptiveAvgPool2d(S)
right between your Last conv layers and 1st Fully connected layer.
Note that your fully connected layer should take input dimension of S x S x no. of channels in last conv layer