This is my code,
RuntimeError: Variable data has to be a tensor, but got int
How do I feed one image and one label to the model and update the model?
You should upgrade your pytorch version as no
Variables are needed anymore.
If your labels is a single python number, you can simply wrap it in a long (or whatever type you criterion expects) tensor as
Thanks. I did this in the same version,
Variable containing:[torch.LongTensor with no dimension]
output_class[get_ans] is 0
When I convert 0 to longtensor it shows no dimension
It should have 1 dimension of size 1:
a = torch.LongTensor()
a.size() # Gives torch.Size()
Also there should be no mention of
Variable if you use the latest pytorch version.
Thanks a lot. I got another error
RuntimeError: Trying to backward through the graph a second time, but the buffers have already been freed. Specify retain_graph=True when calling backward the first time.
Iam actually manually upgrading the weights by getting inputs from user. I read your answer to provide
retain_graph=True. Still it does not work. Here is my code.