jikechao opened a new issue, #14883:
URL: https://github.com/apache/tvm/issues/14883
For the AdaptiveMaxPool1d. if the attribute `return_indices` was set to
`True`, (e.g., `AdaptiveMaxPool1d(2,return_indices=True)`), when loading it to
RelayIR, TVM will crash and throw: **AttributeError: 'NoneType' object has no
attribute 'dtype'**
### Actual behavior
```
Traceback (most recent call last):
File "7_crash_none_type.py", line 11, in <module>
mod, params = relay.frontend.from_pytorch(trace, input_shapes)
File "/workplace/software/tvm/tvm/python/tvm/relay/frontend/pytorch.py",
line 4969, in from_pytorch
outputs = converter.convert_operators(operator_nodes, outputs, ret_name)
File "/workplace/software/tvm/tvm/python/tvm/relay/frontend/pytorch.py",
line 4256, in convert_operators
return [_wrap_const(outputs[ret_name]) for ret_name in ret_names]
File "/workplace/software/tvm/tvm/python/tvm/relay/frontend/pytorch.py",
line 4256, in <listcomp>
return [_wrap_const(outputs[ret_name]) for ret_name in ret_names]
File "/workplace/software/tvm/tvm/python/tvm/relay/frontend/pytorch.py",
line 4403, in _wrap_const
return _expr.const(c)
File "/workplace/software/tvm/tvm/python/tvm/relay/expr.py", line 677, in
const
value.dtype, None
AttributeError: 'NoneType' object has no attribute 'dtype'
```
### Steps to reproduce
```
import torch
from tvm import relay
m = torch.nn.AdaptiveMaxPool1d(3, return_indices=True) # crash when
return_indices=True
input_data=[torch.randn([2,2,4], dtype=torch.float32)]
trace = torch.jit.trace(m, input_data)
input_shapes = [('input0', torch.Size([2, 2, 4]))]
mod, params = relay.frontend.from_pytorch(trace, input_shapes)
```
### Triage
* frontend:pytorch
--
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]