You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/12/29 07:10:45 UTC
[GitHub] [tvm] Xuxue1 opened a new pull request #7174: [Torch] Support hard_swish op
Xuxue1 opened a new pull request #7174:
URL: https://github.com/apache/tvm/pull/7174
Support hard_swish op https://pytorch.org/docs/stable/generated/torch.nn.Hardswish.html#torch.nn.Hardswish
please review @masahi
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] Xuxue1 commented on a change in pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
Xuxue1 commented on a change in pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#discussion_r549635067
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -3437,6 +3437,12 @@ def test_fn(x, weights=None):
verify_trace_model(test_fn, [inp, weights], targets)
+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)
Review comment:
hard_swish_inplace is not a pure function. It will change input tensor
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi merged pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
masahi merged pull request #7174:
URL: https://github.com/apache/tvm/pull/7174
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] Xuxue1 commented on a change in pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
Xuxue1 commented on a change in pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#discussion_r549640166
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -3437,6 +3437,12 @@ def test_fn(x, weights=None):
verify_trace_model(test_fn, [inp, weights], targets)
+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)
Review comment:
I can modify verify_model function
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] insop commented on a change in pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
insop commented on a change in pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#discussion_r549629698
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -3437,6 +3437,12 @@ def test_fn(x, weights=None):
verify_trace_model(test_fn, [inp, weights], targets)
+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)
Review comment:
Any reason to drop `hard_swish_inplace`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] insop commented on a change in pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
insop commented on a change in pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#discussion_r549629698
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -3437,6 +3437,12 @@ def test_fn(x, weights=None):
verify_trace_model(test_fn, [inp, weights], targets)
+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)
Review comment:
Any reason to drop `hard_swish_inplace` from previous commit?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] Xuxue1 commented on a change in pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
Xuxue1 commented on a change in pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#discussion_r549600191
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -3437,6 +3437,16 @@ def test_fn(x, weights=None):
verify_trace_model(test_fn, [inp, weights], targets)
+def test_hard_swish():
+ hard_swish = torch.nn.Hardswish()
+ hard_swish_inplace = torch.nn.Hardswish(inplace=True)
+ 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)
Review comment:
ok
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi commented on a change in pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#discussion_r549600125
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -3437,6 +3437,16 @@ def test_fn(x, weights=None):
verify_trace_model(test_fn, [inp, weights], targets)
+def test_hard_swish():
+ hard_swish = torch.nn.Hardswish()
+ hard_swish_inplace = torch.nn.Hardswish(inplace=True)
+ 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)
Review comment:
`verify_trace_model` is supposed to be used for dynamic models that require VM compilation. Please use `verify_model` instead.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi commented on pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
masahi commented on pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#issuecomment-752087947
Thanks @Xuxue1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi commented on pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
masahi commented on pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#issuecomment-751981079
@Xuxue1 Great! please run `black pytorch.py`
cc @zhiqwang
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] insop commented on a change in pull request #7174: [Torch] Support hard_swish op
Posted by GitBox <gi...@apache.org>.
insop commented on a change in pull request #7174:
URL: https://github.com/apache/tvm/pull/7174#discussion_r549658674
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -3437,6 +3437,12 @@ def test_fn(x, weights=None):
verify_trace_model(test_fn, [inp, weights], targets)
+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)
Review comment:
Looks great!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org