[jit] Add some of nn.init to weak script#19640
Closed
driazati wants to merge 3 commits into
Closed
Conversation
[jit] Add some of nn.init to weak script gh-metadata: pytorch pytorch 19640 gh/driazati/26/head
eellison
reviewed
Apr 23, 2019
[jit] Add some of nn.init to weak script gh-metadata: pytorch pytorch 19640 gh/driazati/26/head
b606124 to
ebc8c39
Compare
eellison
approved these changes
Apr 24, 2019
Contributor
eellison
left a comment
There was a problem hiding this comment.
LGTM. A little more coverage on different inputs would be nice, as would be adding the div float / int, which should be a really really easy change.
|
|
||
| def test_nn_init(self): | ||
| tests = ( | ||
| ('constant_', (lambda: (torch.ones(2, 2), 2.5)), "Tensor, float"), |
Contributor
There was a problem hiding this comment.
Can you switch it to rand ? plz do so before landing
eellison
reviewed
Apr 25, 2019
| """ | ||
| with torch.no_grad(): | ||
| return tensor.fill_(1) | ||
| return _no_grad_fill_(tensor, 1.) |
Contributor
There was a problem hiding this comment.
Hmm it looks like this is changing the semantics, because previously the type of the tensor would have been preserved, but now it is being filled with floats. ALthought not 100% sure
Contributor
zhangguanheng66
pushed a commit
to zhangguanheng66/pytorch
that referenced
this pull request
May 6, 2019
Summary: Stack from [ghstack](https://github.com/ezyang/ghstack): * **pytorch#19640 [jit] Add some of nn.init to weak script** Pull Request resolved: pytorch#19640 Pulled By: driazati Differential Revision: D15065332 fbshipit-source-id: 30df9f02e527cd5e5ebe34b7e003444eae96c66d
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
Summary: Stack from [ghstack](https://github.com/ezyang/ghstack): * **pytorch#19640 [jit] Add some of nn.init to weak script** Pull Request resolved: pytorch#19640 Pulled By: driazati Differential Revision: D15065332 fbshipit-source-id: 30df9f02e527cd5e5ebe34b7e003444eae96c66d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
Differential Revision: D15065332