Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

07_diabets_logistic.py #3

Closed
ys7yoo opened this issue May 3, 2019 · 2 comments

Comments

Projects
None yet
1 participant
@ys7yoo
Copy link
Owner

commented May 3, 2019

/anaconda3/envs/torch/lib/python3.5/site-packages/torch/nn/_reduction.py:49: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead.
  warnings.warn(warning.format(ret))
Traceback (most recent call last):
  File "07_diabets_logistic.py", line 55, in <module>
    print(epoch, loss.data[0])
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
@ys7yoo

This comment has been minimized.

Copy link
Owner Author

commented May 3, 2019

replaced

criterion = torch.nn.BCELoss(size_average=True)

with

criterion = torch.nn.BCELoss(reduction='mean')
@ys7yoo

This comment has been minimized.

Copy link
Owner Author

commented May 3, 2019

replaced

    print(epoch, loss.data[0])

with

    print(epoch, loss.item())

@ys7yoo ys7yoo closed this May 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.