Thank you very much for your quick reply. That seems to have worked but now I am getting the following error:
RuntimeError: input and target shapes do not match: input [4 x 10], target [4 x 4]

Does this have something to do with my neural network?