You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "LeshengJin (via GitHub)" <gi...@apache.org> on 2023/03/23 20:58:16 UTC

[GitHub] [tvm] LeshengJin opened a new pull request, #14388: [Unity][Op] Conv1d

LeshengJin opened a new pull request, #14388:
URL: https://github.com/apache/tvm/pull/14388

   This PR implements `Conv1d`.
   
   Unit tests are provided accordingly.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tqchen merged pull request #14388: [Unity][Op] Conv1d

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen merged PR #14388:
URL: https://github.com/apache/tvm/pull/14388


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] MasterJH5574 commented on a diff in pull request #14388: [Unity][Op] Conv1d

Posted by "MasterJH5574 (via GitHub)" <gi...@apache.org>.
MasterJH5574 commented on code in PR #14388:
URL: https://github.com/apache/tvm/pull/14388#discussion_r1147933911


##########
include/tvm/relax/attrs/nn.h:
##########
@@ -29,6 +29,49 @@
 namespace tvm {
 namespace relax {
 
+/*! \brief Attributes used in Conv1d operator */
+struct Conv1DAttrs : public tvm::AttrsNode<Conv1DAttrs> {

Review Comment:
   It seems possible to unify them together. We can do sanity checks in respective struct info inference of conv1d and conv2d.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] yongwww commented on a diff in pull request #14388: [Unity][Op] Conv1d

Posted by "yongwww (via GitHub)" <gi...@apache.org>.
yongwww commented on code in PR #14388:
URL: https://github.com/apache/tvm/pull/14388#discussion_r1147552506


##########
include/tvm/relax/attrs/nn.h:
##########
@@ -29,6 +29,49 @@
 namespace tvm {
 namespace relax {
 
+/*! \brief Attributes used in Conv1d operator */
+struct Conv1DAttrs : public tvm::AttrsNode<Conv1DAttrs> {

Review Comment:
   I see, thanks. 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] yongwww commented on a diff in pull request #14388: [Unity][Op] Conv1d

Posted by "yongwww (via GitHub)" <gi...@apache.org>.
yongwww commented on code in PR #14388:
URL: https://github.com/apache/tvm/pull/14388#discussion_r1146969196


##########
include/tvm/relax/attrs/nn.h:
##########
@@ -29,6 +29,49 @@
 namespace tvm {
 namespace relax {
 
+/*! \brief Attributes used in Conv1d operator */
+struct Conv1DAttrs : public tvm::AttrsNode<Conv1DAttrs> {

Review Comment:
   looks it is quite similar to Conv2Dattrs, probably we can unify them into a ConvAttrs



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] LeshengJin commented on a diff in pull request #14388: [Unity][Op] Conv1d

Posted by "LeshengJin (via GitHub)" <gi...@apache.org>.
LeshengJin commented on code in PR #14388:
URL: https://github.com/apache/tvm/pull/14388#discussion_r1149641563


##########
tests/python/relax/test_tvmscript_parser_op_nn.py:
##########
@@ -35,6 +35,24 @@ def _check(
         tvm.ir.assert_structural_equal(parsed, expect)
 
 
+def test_conv1d():
+    @R.function
+    def foo(
+        x: R.Tensor((2, 3, 228), "float32"), w: R.Tensor((16, 3, 5), "float32")
+    ) -> R.Tensor((2, 16, 224), "float16"):
+        gv: R.Tensor((2, 16, 224), "float16") = R.nn.conv1d(x, w, out_dtype="float16")

Review Comment:
   Fixed
   Thank you for the review! 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] Hzfengsy commented on a diff in pull request #14388: [Unity][Op] Conv1d

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on code in PR #14388:
URL: https://github.com/apache/tvm/pull/14388#discussion_r1148579176


##########
tests/python/relax/test_tvmscript_parser_op_nn.py:
##########
@@ -35,6 +35,24 @@ def _check(
         tvm.ir.assert_structural_equal(parsed, expect)
 
 
+def test_conv1d():
+    @R.function
+    def foo(
+        x: R.Tensor((2, 3, 228), "float32"), w: R.Tensor((16, 3, 5), "float32")
+    ) -> R.Tensor((2, 16, 224), "float16"):
+        gv: R.Tensor((2, 16, 224), "float16") = R.nn.conv1d(x, w, out_dtype="float16")

Review Comment:
   Not a big problem, but it is not a common case to take fp32 as input and fp16 as output :-)



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tqchen commented on a diff in pull request #14388: [Unity][Op] Conv1d

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on code in PR #14388:
URL: https://github.com/apache/tvm/pull/14388#discussion_r1149396988


##########
tests/python/relax/test_tvmscript_parser_op_nn.py:
##########
@@ -35,6 +35,24 @@ def _check(
         tvm.ir.assert_structural_equal(parsed, expect)
 
 
+def test_conv1d():
+    @R.function
+    def foo(
+        x: R.Tensor((2, 3, 228), "float32"), w: R.Tensor((16, 3, 5), "float32")
+    ) -> R.Tensor((2, 16, 224), "float16"):
+        gv: R.Tensor((2, 16, 224), "float16") = R.nn.conv1d(x, w, out_dtype="float16")

Review Comment:
   right, would be good to change x and w to float16 in here



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tqchen commented on a diff in pull request #14388: [Unity][Op] Conv1d

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on code in PR #14388:
URL: https://github.com/apache/tvm/pull/14388#discussion_r1148099426


##########
include/tvm/relax/attrs/nn.h:
##########
@@ -29,6 +29,49 @@
 namespace tvm {
 namespace relax {
 
+/*! \brief Attributes used in Conv1d operator */
+struct Conv1DAttrs : public tvm::AttrsNode<Conv1DAttrs> {

Review Comment:
   Let us keep them separate for now 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tvm-bot commented on pull request #14388: [Unity][Op] Conv1d

Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14388:
URL: https://github.com/apache/tvm/pull/14388#issuecomment-1481897598

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * cc @quic-sanirudh <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] LeshengJin commented on a diff in pull request #14388: [Unity][Op] Conv1d

Posted by "LeshengJin (via GitHub)" <gi...@apache.org>.
LeshengJin commented on code in PR #14388:
URL: https://github.com/apache/tvm/pull/14388#discussion_r1147233571


##########
include/tvm/relax/attrs/nn.h:
##########
@@ -29,6 +29,49 @@
 namespace tvm {
 namespace relax {
 
+/*! \brief Attributes used in Conv1d operator */
+struct Conv1DAttrs : public tvm::AttrsNode<Conv1DAttrs> {

Review Comment:
   Thank you for your review! 
   
   I am not sure if we need to unify them into a `ConvNDAttrs`, since there are several differences between `Conv1d` and `Conv2d` that are worth noting. 
   
   1. `strides`/`dilation` for `Conv1d` can either be an integer or a tuple/list of a single integer, whereas for `Conv2d`, it can be a list of two integers, strides for H and W.
   2. `padding` for `Conv1d` is at most a two-int list(padding left and right), while for `Conv2d`, it can be a list of four integers that indicate padding on the top, left, bottom, and right. 
   3. `data_layout`: "NCW" for `Conv1d` and "NCHW" for `Conv2d`.
   4. `kernel_layout`: "OIW" for `Conv1d` and "OIHW" for `Conv2d`.
   
   Let's get more feedbacks from the community!
   



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org