monklof commented on a change in pull request #7496:
URL: https://github.com/apache/tvm/pull/7496#discussion_r595689869
##########
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:
@comaniac I haven't found a way yet to do assertion or `batch dim
semantic checking` inside te's `compute` or `schedule`, and left this change to
the future work, 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.
For queries about this service, please contact Infrastructure at:
[email protected]