rkimball commented on a change in pull request #6616:
URL: https://github.com/apache/incubator-tvm/pull/6616#discussion_r498999529



##########
File path: python/tvm/topi/x86/batch_matmul.py
##########
@@ -45,16 +45,18 @@ def batch_matmul(cfg, x, y):
     assert len(x.shape) == 3 and len(y.shape) == 3, "only support 3-dim 
batch_matmul"
     XB, M, XK = get_const_tuple(x.shape)
     YB, N, YK = get_const_tuple(y.shape)
-    assert XB == YB, "batch dimension doesn't match"
+    assert (XB == YB) or (YB == 1) or (XB == 1), "batch dimension doesn't 
match"

Review comment:
       ```suggestion
       assert (XB == YB) or (YB == 1) or (XB == 1), "batch dimensions don't 
match"
   ```

##########
File path: tests/python/topi/python/test_topi_dense.py
##########
@@ -75,6 +75,8 @@ def check_device(device, ctx):
             b = tvm.nd.array(b_np, ctx)
             c = tvm.nd.array(c_np, ctx)
             d = tvm.nd.array(np.zeros(get_const_tuple(D.shape), dtype=dtype), 
ctx)
+            print(tvm.lower(s, [A, B, C, D], simple_mode=True))
+            exit()

Review comment:
       ```suggestion
   ```

##########
File path: src/relay/op/nn/nn.cc
##########
@@ -851,14 +851,17 @@ bool BatchMatmulRel(const Array<Type>& types, int 
num_inputs, const Attrs& attrs
   const auto* y = types[1].as<TensorTypeNode>();
   if (x == nullptr || y == nullptr) return false;
   CHECK(x->shape.size() == 3 && y->shape.size() == 3);
-  CHECK(reporter->AssertEQ(x->shape[0], y->shape[0]))
+  CHECK(reporter->AssertEQ(x->shape[0], y->shape[0]) || 
+        reporter->AssertEQ(x->shape[0], 1) ||
+        reporter->AssertEQ(y->shape[0], 1))
       << "BatchDot: batch dimension doesn't match, "

Review comment:
       ```suggestion
         << "BatchDot: batch dimensions don't match, "
   ```




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


Reply via email to