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

Various PyTorch 0.4.0 updates #12

Closed
wants to merge 1 commit into from

Conversation

marikgoldstein
Copy link
Contributor

This commit fixes a few deprecation warnings thrown by PyTorch 0.4.0.

Merge of Variable and Tensor:

  • change Variable(a_tensor) to a_tensor

Support for PyTorch Scalars of 0-dimension

  • changeloss.data[0] to loss.item()

Naming conventions in nn.init

  • change nn.init.constant to nn.init.constant_
  • change nn.init.uniform to nn.init.uniform_
  • change nn.init.xavier_uniform to nn.init.xavier_uniform_

This pull request does not fix TypeError: Object of type 'Tensor' is not JSON serializable thrown by save_checkpoint on line 83 of train.py, which seems to be an issue new to PyTorch 0.4.0.

Thanks! This is a great implementation!!!
Mark

@loudinthecloud loudinthecloud self-assigned this Jun 26, 2018
@loudinthecloud
Copy link
Owner

Thanks for the pull request, much appreciated!

The TypeError was due to the cost variable being a Tensor as well, fixed it locally. I'll rebase and merge this branch.

@loudinthecloud
Copy link
Owner

Merged as 3c64937
Thanks!

@marikgoldstein
Copy link
Contributor Author

Thanks! Awesome repo.

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 this pull request may close these issues.

None yet

2 participants