wzh99 commented on issue #12400: URL: https://github.com/apache/tvm/issues/12400#issuecomment-1223686540
@padreofthegame @ganler Hey guys, I am the author of #11697. I appreciate your efforts in solving this problem related to `squeeze`. Here I mainly want to share my analysis for this problem. After checking the source code in Relay and TOPI, I think the root cause lies in the difference between how Relay and TOPI handle empty `axis`. In Relay type inference of `squeeze`, `axis=[]` does nothing to the input tensor: https://github.com/apache/tvm/blob/3983a472c6f3ad4ad9604ceeffdf80cce01d166b/src/relay/op/tensor/transform.cc#L2301-L2311 In TOPI implementation of `squeeze`, however, `axis=[]` is the same as `axis=None`, which squeezes all possible axes: https://github.com/apache/tvm/blob/3983a472c6f3ad4ad9604ceeffdf80cce01d166b/include/tvm/topi/transform.h#L411-L416 That explains why the tensor shape in compiled module is not consistent with the one in Relay. To fix this, I think we should modify the C++ code in either Relay or TOPI. It should be decided whether `axis=[]` means doing nothing, or squeezing all possible axes. Maybe we can ask @ganler and other TVM developers for determination. Personally I do not completely agree with the solution proposed by @padreofthegame, as this is just a workaround at Python side and does not completely solve this problem. -- 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: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org