I have to modify the last layer of resnet18 in pytorch where the size of labels=(2,10).
I tried to do that but I am getting errors because of labels size .How to resolve it.
My code for that:-
in_features = resnet.fc.in_features
resnet.fc = nn.Linear(in_features, labels)
Here the size of labels is creating problems as it is (2,10).?
Welcome to the PyTorch Forums
Please wrap your code around ``` helps in readability
Coming to your question,
Why are your labels
(2, 10) ?
Labels are the number of classes it should be a scalar value.
I have a problem statement in which image is given in which some text are written.I have to design it in such a manner that it predicts vowels (10 different vowels) and consonants(10 different consonants) simultaneously.That is the reason the shape of calss is (2,10).2 stands for vowels and consonants each of size 10.I am attaching pic for more clarity