hzfan commented on a change in pull request #8622:
URL: https://github.com/apache/tvm/pull/8622#discussion_r682028497



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1445,7 +1445,7 @@ def linear(self, inputs, input_types):
         # 0 - input
         # 1 - weight
         bias = inputs[2]
-        mm_out = self.matmul(inputs[:2], input_types[:2])
+        mm_out = self.matmul([inputs[0], _op.transpose(inputs[1], axes=(1, 
0))], input_types[:2])

Review comment:
       @masahi  Tests with 3d input are added. For now I use `dense` when both 
inputs are 2d and fallback to `matmul` otherwise.
   
   I tried `op.nn.dense` in ND scenario, but it fails at 
   
https://github.com/apache/tvm/blob/4b9d43e05b819f1f38420b90abca948070811687/python/tvm/topi/x86/dense_alter_op.py#L29-L37
   
   where `data_tensor.shape` is unpacked into a tuple of size 2. I also check 
that in `tests/python/relay/test_op_level1.py` `dense` is tested numerically 
for 2d inputs only.  Not sure if I miss anything.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to