You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/10/01 05:30:15 UTC

[GitHub] [incubator-tvm] masahi edited a comment on issue #6594: [Torch, CI] Support PyTorch 1.6

masahi edited a comment on issue #6594:
URL: https://github.com/apache/incubator-tvm/issues/6594#issuecomment-701877144


   @kevinthesun @yongwww I've taken a look at supporting detection models in 1.6. It turned out we need to convert a function `batched_nms` that was traced in 1.4, but now it is scripted. This brings a very nasty typing problem.
   
   Looking at this code,
   https://github.com/pytorch/vision/blob/6e10e3f88158f12b7a304d3c2f803d2bbdde0823/torchvision/ops/boxes.py#L75-L86
   
   One of the types of if branch is a zero dim empty tensor of dtype int64 https://github.com/pytorch/vision/blob/6e10e3f88158f12b7a304d3c2f803d2bbdde0823/torchvision/ops/boxes.py#L76
   while the type of other branch is a dynamic 1D tensor of dtype int32 https://github.com/pytorch/vision/blob/6e10e3f88158f12b7a304d3c2f803d2bbdde0823/torchvision/ops/boxes.py#L85-L86
   
   We cannot type check the converted Relay model with `If`, because dtype of two branches are different. Even if I force the dtype to be the same, if one branch is `Any` shape while the other is static, Relay type inference chooses a static shape for the type of `If`. So the return type of above function becomes a zero dim tensor. 
   
   Is there a way to turn a static shape tensor to dynamic, when one of `If` branch is dynamic while other is static?  


----------------------------------------------------------------
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:
users@infra.apache.org