yunjey / pytorch-tutorial

PyTorch Tutorial for Deep Learning Researchers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuntimeError in Logistic Regression python file

htlee6 opened this issue · comments

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:

    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.