-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Add inplace option for torch.nn.Hardsigmoid and torch.nn.Hardswish layers #42346
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
Conversation
albanD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review!
This looks good. Thanks for the PR!
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@albanD has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
hello @miraliahmadli here is my code of the torch.nn.Hardsigmoid and torch.nn.Hardswish classes . class Tanh(Module): class SiLU(Module): class Hardswish(Module): Thank your for your help. |
torch.nn.Hardsigmoidandtorch.nn.Hardswishclasses currently do not supportinplaceoperations as it usestorch.nn.functional.hardsigmoidandtorch.nn.functional.hardswishfunctions with their default inplace argument which isFalse.So, I added
inplaceargument fortorch.nn.Hardsigmoidandtorch.nn.Hardswishclasses so that forward operation can be done inplace as well while using these layers.