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/09/08 18:15:28 UTC

[GitHub] [incubator-tvm] kevinthesun opened a new pull request #6422: Fix broadcast shape

kevinthesun opened a new pull request #6422:
URL: https://github.com/apache/incubator-tvm/pull/6422


   Fix broadcast infer shape so that symbolic expression shape can be accepted.
   
   @icemelon9 @zhiics 
   


----------------------------------------------------------------
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] [incubator-tvm] jroesch commented on pull request #6422: Fix broadcast shape

Posted by GitBox <gi...@apache.org>.
jroesch commented on pull request #6422:
URL: https://github.com/apache/incubator-tvm/pull/6422#issuecomment-689086865


   cc @mbrookhart @electriclilies 


----------------------------------------------------------------
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] [incubator-tvm] zhiics commented on a change in pull request #6422: Fix broadcast shape

Posted by GitBox <gi...@apache.org>.
zhiics commented on a change in pull request #6422:
URL: https://github.com/apache/incubator-tvm/pull/6422#discussion_r485221856



##########
File path: tests/python/relay/test_any.py
##########
@@ -801,6 +801,27 @@ def test_any_ndarray_size():
     verify_any_ndarray_size((2, 2))
     verify_any_ndarray_size((1, 2, 3, 4))
 
+def test_any_consecutive_broadcast():
+    data0 = relay.var("data0", shape=any_dims(2), dtype='float32')
+    data1 = relay.var("data1", shape=any_dims(2), dtype='float32')
+    data2 = relay.var("data2", shape=any_dims(2), dtype='float32')
+    data3 = relay.var("data3", shape=any_dims(2), dtype='float32')
+
+    out0 = data0 + data1
+    out1 = data0 * data1
+    out2 = out0 - out1
+
+    out3 = data2 + data3
+    out4 = data2 * data3
+    out5 = out3 - out4
+
+    out6 = out2 * out5
+
+    mod = tvm.IRModule()
+    mod['main'] = relay.Function([data0, data1, data2, data3], out6)
+
+    relay.create_executor("vm", mod=mod, ctx=tvm.cpu(), target="llvm")

Review comment:
       let's use `check_results` and feed it with data so that we can run it on both gpu and cpu




----------------------------------------------------------------
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] [incubator-tvm] zhiics merged pull request #6422: Fix broadcast shape

Posted by GitBox <gi...@apache.org>.
zhiics merged pull request #6422:
URL: https://github.com/apache/incubator-tvm/pull/6422


   


----------------------------------------------------------------
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] [incubator-tvm] kevinthesun commented on a change in pull request #6422: Fix broadcast shape

Posted by GitBox <gi...@apache.org>.
kevinthesun commented on a change in pull request #6422:
URL: https://github.com/apache/incubator-tvm/pull/6422#discussion_r485252800



##########
File path: include/tvm/topi/detail/broadcast.h
##########
@@ -51,8 +51,8 @@ inline BroadcastHelper BroadcastShape(const tvm::Array<tvm::PrimExpr>& shape1,
   int i;
   for (i = 1; i <= std::min(s1_size, s2_size); ++i) {
     // TODO(@icemelon9): Need to revisit this part
-    const VarNode* var1 = shape1[s1_size - i].as<VarNode>();
-    const VarNode* var2 = shape2[s2_size - i].as<VarNode>();
+    const IntImmNode* static_size1 = shape1[s1_size - i].as<IntImmNode>();

Review comment:
       We need to check IntImm to include any symbolic expression type. Here Any might not work.




----------------------------------------------------------------
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] [incubator-tvm] zhiics commented on pull request #6422: Fix broadcast shape

Posted by GitBox <gi...@apache.org>.
zhiics commented on pull request #6422:
URL: https://github.com/apache/incubator-tvm/pull/6422#issuecomment-690386154


   Thanks @kevinthesun @jroesch @mbrookhart @electriclilies @icemelon9 


----------------------------------------------------------------
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] [incubator-tvm] zhiics commented on a change in pull request #6422: Fix broadcast shape

Posted by GitBox <gi...@apache.org>.
zhiics commented on a change in pull request #6422:
URL: https://github.com/apache/incubator-tvm/pull/6422#discussion_r485222319



##########
File path: include/tvm/topi/detail/broadcast.h
##########
@@ -51,8 +51,8 @@ inline BroadcastHelper BroadcastShape(const tvm::Array<tvm::PrimExpr>& shape1,
   int i;
   for (i = 1; i <= std::min(s1_size, s2_size); ++i) {
     // TODO(@icemelon9): Need to revisit this part
-    const VarNode* var1 = shape1[s1_size - i].as<VarNode>();
-    const VarNode* var2 = shape2[s2_size - i].as<VarNode>();
+    const IntImmNode* static_size1 = shape1[s1_size - i].as<IntImmNode>();

Review comment:
       BTW, any difference in checking Any or int?




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