Skip to content

Conversation

@ailzhang
Copy link
Contributor

@ailzhang ailzhang commented Nov 8, 2019

No description provided.

@ailzhang ailzhang requested review from suo and zdevito November 8, 2019 03:39
@ailzhang ailzhang requested a review from apaszke as a code owner November 8, 2019 03:39
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Nov 8, 2019
Copy link
Collaborator

@ssnl ssnl left a comment

Choose a reason for hiding this comment

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

wow nice catch! pretty big bug I'd say though.....

test/test_jit.py Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

did you mean to use self.dropout here?

@bddppq
Copy link
Contributor

bddppq commented Nov 8, 2019

Thanks for fixing

test/test_jit.py Outdated
FileCheck().check("aten::bernoulli_").run(scripted_module.graph_for(X))
FileCheck().check("aten::bernoulli_").run(scripted_func.graph_for(X))

X = torch.randn(M, M, requires_grad=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The condition here is a bit weird. It should not depend on whether x is requiring grad, but on whether m is in training mode, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

The torchscript executor only bothers to split out symbolic gradients when the inputs require_grad, which is probably why these flags are getting set here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My question was more about why there is not a .eval() here to switch the scripted module to eval mode. Unless .graph_for auto selected train / eval mode based on input requires_grad which sounds wrong to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ssnl @zdevito @bddppq Thanks for the comments! To make the testcase a bit more clear, I've added a comment here to explain the behavior. https://github.com/pytorch/pytorch/pull/29436/files#diff-78aab5b4217aeaed920efab0c5f5f5c8R2202
Please let me know if that looks good! Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you so much!!!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@ailzhang merged this pull request in 8875120.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants