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

Allow compatibility with latest torch (torch 18.1) #25

Closed
colleenjg opened this issue Aug 1, 2021 · 2 comments · Fixed by #26
Closed

Allow compatibility with latest torch (torch 18.1) #25

colleenjg opened this issue Aug 1, 2021 · 2 comments · Fixed by #26

Comments

@colleenjg
Copy link
Contributor

I've been running the codebase with one of the latest torch versions (18.1) with only 3 small compatibility problems coming up, per my usage.

dpc/main.py, lines 215 and 267:

  • target_flattened raises 2 errors:
    • It is not automatically placed on cuda when created, which leads to an error when criterion() is called.
      => Solution: explicitly place on cuda before the call to criterion()
    • It is a boolean tensor, and argmax() now raises an error with boolean tensors.
      => Solution: convert to int before calling argmax().

utils/utils.py, line 53:

  • .view(-1) in correct_k = correct[:k].view(-1).float().sum(0) raises a runtime error (message: view size is not compatible with input tensor's size and stride...)
    => Solution: either use .reshape(-1) or make a call to .contiguous() before using .view(-1).

The bugs are quite minor with easy solutions that shouldn't cause a problem for previous torch versions. I am happy to make a pull request if helpful!

Thanks! :)

@TengdaHan
Copy link
Owner

Ahh, thank you for the checking and I am very grateful if you can make a pull request!

@colleenjg
Copy link
Contributor Author

Great! Just made the above pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants