Neural Net isn't converging and I can't figure out why

Hey guys! I’m trying to do something in pytorch after doing in fastai but I can’t make it work.
I’m trying to build a network that takes in MNIST and a random int and outputs the label and the sum of the label and the random value
I’ve been able to do both MNIST and the sum thing and make it work. But this isn’t working together, and for the life of me I can’t figure out why this isn’t converging

1 Like

Here is my version of your code that trains properly. I think the learning rate is a little high and I think that output2 needs to be squeezed so it is the same size as your target:

If those changes don’t fix your issue, let me know and I will look again to see what else I might have changed.

3 Likes

This works. Thanks a lot!