Skip to content

RuntimeError in Logistic Regression python file #220

Open
@htlee6

Description

@htlee6

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions