Skip to content

Provide polyfill shim for torch.no_grad()#644

Merged
jpchen merged 1 commit intodevfrom
torch-no-grad
Dec 21, 2017
Merged

Provide polyfill shim for torch.no_grad()#644
jpchen merged 1 commit intodevfrom
torch-no-grad

Conversation

@fritzo
Copy link
Copy Markdown
Member

@fritzo fritzo commented Dec 21, 2017

PyTorch 0.4 is dropping the .volatile attribute in favor of a torch.no_grad() context manager. Pyro's tests suite currently fails against PyTorch master. This PR fixes the tests by:

  • adding a pyro.shim module
  • addding torch_no_grad() and is_volatile() methods that work in PyTorch 0.2, 0.3, and 0.4 (master)
  • removing all volatile=True from codebase (I believe this changes performance but not semantics)

Tested:

  • CI tests run against PyTorch 0.2
  • ran make test against PyTorch 0.3
  • ran make test against PyTorch 0.4 master 2017-12-21 (tests failed before this PR)

Copy link
Copy Markdown
Collaborator

@martinjankowiak martinjankowiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@fritzo
Copy link
Copy Markdown
Member Author

fritzo commented Dec 21, 2017

merge at will

@jpchen jpchen merged commit 3450cdd into dev Dec 21, 2017
@fritzo fritzo deleted the torch-no-grad branch January 5, 2018 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants