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

Add pure functional dropout #456

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

junjihashimoto
Copy link
Member

This PR provides pure functional dropout.
dropout implementation is here.
When training, it uses _fused_dropout. _fused_dropout can use local generater.
https://github.com/pytorch/pytorch/blob/1.6/aten/src/ATen/native/Dropout.cpp
https://github.com/pytorch/pytorch/blob/1.6/aten/src/ATen/native/native_functions.yaml#L167

-> Maybe Generator -- ^ generator
-> Tensor -- ^ input
-> (Tensor,Generator) -- ^ output
dropout p Nothing input = cast3 ATen.dropout_tdb input p False
Copy link
Member

Choose a reason for hiding this comment

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

Hi @junjihashimoto, this looks great, thank you for working on this.
This line here is odd, though. I don't understand how this can return a Generator when Nothing is passed into it. Isn't ATen.dropout_tdb the one that returns IO Tensor?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for your pointing it out. If the input generator is Nothing, the output generator should also return Nothing or just a Tensor(not the Tuple).

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