AndrewZhaoLuo commented on code in PR #13615:
URL: https://github.com/apache/tvm/pull/13615#discussion_r1048982843


##########
src/relay/op/nn/nn.h:
##########
@@ -115,20 +115,36 @@ bool MatmulRel(const Array<Type>& types, int num_inputs, 
const Attrs& attrs,
         auto sb = B_shape.size();
         if (transpose_a && transpose_b) {
           auto tmp = A_shape[sa - 2];
-          A_shape[sa - 2] = B_shape[sb - 1];
-          B_shape[sb - 1] = tmp;
+          if (A_shape[sa - 2].as<tir::AnyNode>()) {

Review Comment:
   There is now a ton of nesting. To make it readable I suggest a structure 
like 
   ```
   A_shape_new = ...
   B_shape_new = ...
   index_swap_a, index_swap_b;
   
   if (transpose_a && transpose_b) {
      // calculate index_swap_a and index_swap_b
   } ... 
   
   if (A_shape[index_swap_a].as<Any>...) {
       // do swap
   }
   
   if (B_shape[index_swap_b].as<Any>...
   ```
   
   
   
   



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