The line that is causing a problem is the line that prints cord3, sometimes pytorch doesn’t know how to properly turn it into a string. Maybe it contains NaNs, I don’t know.
I can only suggest that you remove that line and either everything else will work, or you will get nan loss, or you could get a more informative error.