I hope this is correct place to ask a very beginner question.
I’m trying to create some names with this tutorial:
When I run code copy pasted from it, I get an error:
Traceback (most recent call last): File "/home/sivarion/PycharmProjects/pythonProject/tut.py", line 167, in <module> output, loss = train(*randomTrainingExample()) File "/home/sivarion/PycharmProjects/pythonProject/tut.py", line 150, in train loss.backward() AttributeError: 'int' object has no attribute 'backward'
It looks correct, as in train() function loss is declared as:
loss = 0
It is indeed an integer and it is hard to expect for it to have .backward() method.
But in tutorial it states explicit, that:
The magic of autograd allows you to simply sum these losses at each step and call backward at the end.
I’m not sure what should I do here and how to correctly define loss in this case.
Thank you in advance!