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

[Torch] Support hard_swish op #7174

Merged
merged 6 commits into from Dec 29, 2020
Merged

[Torch] Support hard_swish op #7174

merged 6 commits into from Dec 29, 2020

Conversation

Xuxue1
Copy link
Contributor

@Xuxue1 Xuxue1 commented Dec 29, 2020

@masahi
Copy link
Member

masahi commented Dec 29, 2020

@Xuxue1 Great! please run black pytorch.py

cc @zhiqwang

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)
Copy link
Member

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.

Copy link
Contributor Author

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)
Copy link
Contributor

@insop insop Dec 29, 2020

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great!

@Xuxue1 Xuxue1 requested a review from masahi December 29, 2020 13:33
@masahi masahi merged commit d1399f3 into apache:main Dec 29, 2020
@masahi
Copy link
Member

masahi commented Dec 29, 2020

Thanks @Xuxue1

tkonolige pushed a commit to tkonolige/incubator-tvm that referenced this pull request Jan 11, 2021
* imp_hardswish

* format

* fix

* hard_swish_inplace test case
TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Jan 20, 2021
* imp_hardswish

* format

* fix

* hard_swish_inplace test case
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jan 21, 2021
* imp_hardswish

* format

* fix

* hard_swish_inplace test case
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
* imp_hardswish

* format

* fix

* hard_swish_inplace test case
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.

[Torch] Support aten::hardswish_
3 participants