-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Torch] Support hard_swish op #7174
Conversation
examples = [torch.rand(8), torch.rand(8, 8), torch.rand(8, 16), torch.rand(1, 1, 8)] | ||
targets = ["llvm", "cuda"] | ||
for input in examples: | ||
verify_trace_model(hard_swish, [input], targets) |
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.
verify_trace_model
is supposed to be used for dynamic models that require VM compilation. Please use verify_model
instead.
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.
ok
def test_hard_swish(): | ||
examples = [torch.rand(8).float(), torch.rand(8, 10).float(), torch.rand(1, 1, 10).float()] | ||
for input in examples: | ||
verify_model(torch.nn.Hardswish().eval(), input_data=input) |
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.
Any reason to drop hard_swish_inplace
from previous commit?
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.
hard_swish_inplace is not a pure function. It will change input tensor
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.
I can modify verify_model function
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.
Looks great!
Thanks @Xuxue1 |
* imp_hardswish * format * fix * hard_swish_inplace test case
* imp_hardswish * format * fix * hard_swish_inplace test case
* imp_hardswish * format * fix * hard_swish_inplace test case
* imp_hardswish * format * fix * hard_swish_inplace test case
Closes #6897
Support hard_swish op https://pytorch.org/docs/stable/generated/torch.nn.Hardswish.html#torch.nn.Hardswish
please review @masahi