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/10/14 22:56:58 UTC

[GitHub] [incubator-tvm] jwfromm commented on a change in pull request #6681: [Relay][Frontend][Onnx] Allow A to B broadcasting of batch_matmul and reverse strided slice

jwfromm commented on a change in pull request #6681:
URL: https://github.com/apache/incubator-tvm/pull/6681#discussion_r505043967



##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -532,10 +534,18 @@ def flatten_to_3d(x, x_shape):
             b = _op.transpose(b, [0, 2, 1])
             # Perform a batch matmul.
             output = _op.nn.batch_matmul(a, b)
+            # Determine the output batch dimension.
+            if a_rank >= b_rank:
+                out_batch = _op.strided_slice(a_shape, [0], [infer_shape(a_shape)[0] - 2])
+            else:
+                out_batch = _op.strided_slice(b_shape, [0], [infer_shape(b_shape)[0] - 2])

Review comment:
       Can you check out the changes in the most recent commit? It addresses the corner case but does insert some extra operations. Do you think its worth it?




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