masahi commented on issue #6300:
URL: https://github.com/apache/incubator-tvm/issues/6300#issuecomment-676843042
By comparing two Torchscript IRs, with or without `
self.nodes_offset.long()`, I now understands what's going on.
With the explicit cast, the rhs input of `aten::add` becomes the output of
`aten::to(...)`, which does cast to int64. So when we query the type of rhs, it
correctly returns int64.
```
%29 : Tensor = prim::GetAttr[name="nodes_offset"](%3)
%indexes.1 : Long(1:3, 3:1) = aten::to(%29, %23, %22, %22, %21)
...
%indexes.5 : Long(3:3, 3:1) = aten::add(%indexes.4, %indexes.1, %17)
```
Without the explicit cast, the rhs input of `aten::add` is the output
`GetAttr` (%29 below). And it seems Torchscript cannot return the right type
when asked the type of an output of `GetAttr`, so it simply returns None in
this case.
```
%29 : Tensor = prim::GetAttr[name="nodes_offset"](%3)
...
%indexes.5 : Long(3:3, 3:1) = aten::add(%indexes.4, %29, %19)
```
----------------------------------------------------------------
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]