comaniac commented on a change in pull request #7496:
URL: https://github.com/apache/tvm/pull/7496#discussion_r585785772
##########
File path: python/tvm/topi/nn/batch_matmul.py
##########
@@ -61,9 +62,17 @@ def batch_matmul(x, y, oshape=None,
auto_scheduler_rewritten_layout=""):
_, M, K = x.shape
k = te.reduce_axis((0, K), name="k")
if oshape is None:
- assert XB == YB or XB == 1 or YB == 1, "batch dimension doesn't match"
- assert x_shape[2] == y_shape[2], "shapes of x and y is inconsistent"
- batch = te.max(XB, YB)
+ if isinstance(XB, int) and isinstance(YB, int):
+ assert XB == YB or XB == 1 or YB == 1, "batch dimension doesn't
match"
+ batch = max(XB, YB)
+ elif isinstance(XB, tir.expr.Var):
+ batch = XB
+ else:
+ batch = YB
Review comment:
I understand that, but why we cant simply assign `XB` or `YB` to `batch`
when either or both of them are not `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:
[email protected]