ValueError: only one element tensors can be converted to Python scalars

You try and convert the output of your model to a python scalar with .item() but it complains that it has more than one element, so it cannot do that.
What is the size of your model’s output? What do you try to achieve with this .item() call?

3 Likes