Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[jit] Add some of nn.init to weak script#19640

Closed
driazati wants to merge 3 commits into
gh/driazati/26/basefrom
gh/driazati/26/head
Closed

[jit] Add some of nn.init to weak script#19640
driazati wants to merge 3 commits into
gh/driazati/26/basefrom
gh/driazati/26/head

Conversation

@driazati
Copy link
Copy Markdown
Contributor

@driazati driazati commented Apr 23, 2019

Stack from ghstack:

Differential Revision: D15065332

@pytorchbot pytorchbot added oncall: jit Add this issue/PR to JIT oncall triage queue module: nn Related to torch.nn labels Apr 23, 2019
[jit] Add some of nn.init to weak script

gh-metadata: pytorch pytorch 19640 gh/driazati/26/head
Comment thread torch/nn/init.py Outdated
Comment thread torch/csrc/jit/register_special_ops.cpp Outdated
Comment thread torch/csrc/jit/register_special_ops.cpp Outdated
Comment thread torch/csrc/jit/register_special_ops.cpp Outdated
Comment thread torch/nn/init.py
Comment thread test/test_jit.py
Comment thread test/test_jit.py Outdated
[jit] Add some of nn.init to weak script

gh-metadata: pytorch pytorch 19640 gh/driazati/26/head
@driazati driazati force-pushed the gh/driazati/26/head branch from b606124 to ebc8c39 Compare April 24, 2019 16:53
@driazati driazati requested a review from eellison April 24, 2019 21:16
Copy link
Copy Markdown
Contributor

@eellison eellison left a comment

Choose a reason for hiding this comment

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

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.

Comment thread test/test_jit.py

def test_nn_init(self):
tests = (
('constant_', (lambda: (torch.ones(2, 2), 2.5)), "Tensor, float"),
Copy link
Copy Markdown
Contributor

@eellison eellison Apr 24, 2019

Choose a reason for hiding this comment

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

Can you switch it to rand ? plz do so before landing

@zou3519 zou3519 deleted the gh/driazati/26/head branch April 25, 2019 00:02
Comment thread torch/nn/init.py
"""
with torch.no_grad():
return tensor.fill_(1)
return _no_grad_fill_(tensor, 1.)
Copy link
Copy Markdown
Contributor

@eellison eellison Apr 25, 2019

Choose a reason for hiding this comment

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

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

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@driazati merged this pull request in c08f3d0.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: nn Related to torch.nn oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants