You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm on macOS 10.15.7, torch v1.6.0 and Python v3.8.5
In the current tutorials/01-basics/logistic_regression/main.py, at line 73, it wrotes:
print('Accuracy of the model on the 10000 test images: {} %'.format(100*correct/total))
However, this snippet of code is out of fashion because the interpreter throws a RuntimeError as detailed:
Traceback (most recent call last):
File "/home/lihaotian/IdeaSync/PyCharm/aidl/hw3/github.py", line 73, in <module>
print('Accuracy of the model on the 10000 test images: {} %'.format(100 * correct / total))
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.
Process finished with exit code 1
I will fix this bug soon.
The text was updated successfully, but these errors were encountered:
htlee6
added a commit
to htlee6/pytorch-tutorial
that referenced
this issue
Oct 20, 2020
<The variable `correct` is a tensor object, which may lead to a
RuntimeError when divided by an int. Using the method `.item()` solves
this problem. Fixyunjey#220>
Hi Yunjey,
I'm on macOS 10.15.7, torch v1.6.0 and Python v3.8.5
In the current
tutorials/01-basics/logistic_regression/main.py
, at line 73, it wrotes:However, this snippet of code is out of fashion because the interpreter throws a
RuntimeError
as detailed:I will fix this bug soon.
The text was updated successfully, but these errors were encountered: