masahi commented on issue #6268:
URL: https://github.com/apache/incubator-tvm/issues/6268#issuecomment-685480132
I don't know what to do about it, other than wait for PyTorch people to fix
dtype saving. For quantized models, I added a workaround, but I don't know if
we can come up with a similar workaround (piggy back on to Relay's type
inference).
For reference, here is Torchscript IR with or without save/load:
without save/load
```
graph(%x : Long(4:5, 5:1)):
%1 : Long() = prim::Constant[value={1}]() # test.py:8:0
%2 : int = prim::Constant[value=1]() # test.py:8:0
%3 : Long(4:5, 5:1) = aten::sub(%x, %1, %2) # test.py:8:0
%4 : int = prim::Constant[value=4]() # test.py:8:0
%5 : bool = prim::Constant[value=0]() # test.py:8:0
%6 : bool = prim::Constant[value=0]() # test.py:8:0
%7 : None = prim::Constant()
%y.1 : Long(4:5, 5:1) = aten::to(%3, %4, %5, %6, %7) # test.py:8:0
%9 : int = prim::Constant[value=6]() # test.py:9:0
%10 : bool = prim::Constant[value=0]() # test.py:9:0
%11 : bool = prim::Constant[value=0]() # test.py:9:0
%12 : None = prim::Constant()
%y : Float(4:5, 5:1) = aten::to(%y.1, %9, %10, %11, %12) # test.py:9:0
%14 : int = prim::Constant[value=0]() # test.py:10:0
%15 : int = prim::Constant[value=0]() # test.py:10:0
%16 : int = prim::Constant[value=9223372036854775807]() # test.py:10:0
%17 : int = prim::Constant[value=1]() # test.py:10:0
%18 : Float(4:5, 5:1) = aten::slice(%y, %14, %15, %16, %17) # test.py:10:0
%19 : int = prim::Constant[value=1]() # test.py:10:0
%20 : int = prim::Constant[value=0]() # test.py:10:0
%21 : Float(4:5) = aten::select(%18, %19, %20) # test.py:10:0
return (%21)
```
```
graph(%self : __torch__.PlaceholderModule,
%x.1 : Tensor):
%2 : None = prim::Constant() # :0:0
%3 : bool = prim::Constant[value=0]() # test.py:8:0
%4 : Tensor = prim::Constant[value={1}]() # test.py:8:0
%5 : int = prim::Constant[value=1]() # test.py:8:0
%6 : int = prim::Constant[value=4]() # test.py:8:0
%7 : int = prim::Constant[value=6]() # test.py:9:0
%8 : int = prim::Constant[value=0]() # test.py:10:0
%9 : int = prim::Constant[value=9223372036854775807]() # test.py:10:0
%10 : Tensor = aten::sub(%x.1, %4, %5) # test.py:8:0
%y.1 : Tensor = aten::to(%10, %6, %3, %3, %2) # test.py:8:0
%y0.1 : Tensor = aten::to(%y.1, %7, %3, %3, %2) # test.py:9:0
%13 : Tensor = aten::slice(%y0.1, %8, %8, %9, %5) # test.py:10:0
%14 : Tensor = aten::select(%13, %5, %8) # test.py:10:0
return (%14)
```
----------------------------------------------------------------
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]