alexwong opened a new pull request #7517:
URL: https://github.com/apache/tvm/pull/7517
Was working on a SVDD model and ran into some issues with pool operators.
```
File "tests/python/frontend/pytorch/test_svdd.py", line 39, in <module>
mod, params = relay.frontend.from_pytorch(model, shape_dict)
File "/home/ubuntu/tvm/tvm/python/tvm/relay/frontend/pytorch.py", line
3160, in from_pytorch
ret = converter.convert_operators(_get_operator_nodes(graph.nodes()),
outputs, ret_name)[0]
File "/home/ubuntu/tvm/tvm/python/tvm/relay/frontend/pytorch.py", line
2582, in convert_operators
inputs, _get_input_types(op_node, outputs,
default_dtype=self.default_dtype)
File "/home/ubuntu/tvm/tvm/python/tvm/relay/frontend/pytorch.py", line
1338, in avg_pool2d
return func(data)
File "/home/ubuntu/tvm/tvm/python/tvm/relay/frontend/pytorch.py", line
1332, in func
count_include_pad=count_include_pad,
File "/home/ubuntu/tvm/tvm/python/tvm/relay/op/nn/nn.py", line 1026, in
avg_pool2d
return _make.avg_pool2d(data, pool_size, strides, padding, layout,
ceil_mode, count_include_pad)
File "/home/ubuntu/tvm/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line
237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
[bt] (4) /home/ubuntu/tvm/tvm/build/libtvm.so(TVMFuncCall+0x5b)
[0x7f6ec5b4f8db]
[bt] (3) /home/ubuntu/tvm/tvm/build/libtvm.so(+0xe41916) [0x7f6ec564d916]
[bt] (2)
/home/ubuntu/tvm/tvm/build/libtvm.so(tvm::runtime::TVMMovableArgValueWithContext_::operator
tvm::runtime::Array<tvm::PrimExpr, void><tvm::runtime::Array<tvm::PrimExpr,
void> >() const+0x67) [0x7f6ec4df0217]
[bt] (1)
/home/ubuntu/tvm/tvm/build/libtvm.so(tvm::runtime::Array<tvm::PrimExpr, void>
tvm::runtime::TVMPODValue_::AsObjectRef<tvm::runtime::Array<tvm::PrimExpr,
void> >() const+0x438) [0x7f6ec4df00a8]
[bt] (0) /home/ubuntu/tvm/tvm/build/libtvm.so(+0x5d5612) [0x7f6ec4de1612]
File "/home/ubuntu/tvm/tvm/include/tvm/runtime/packed_func.h", line 687
TVMError: In function relay.op.nn._make.avg_pool2d: error while converting
argument 2: [10:04:02]
/home/ubuntu/tvm/tvm/include/tvm/runtime/packed_func.h:1564:
---------------------------------------------------------------
An internal invariant was violated during the execution of TVM.
Please read TVM's error reporting guidelines.
More details can be found here:
https://discuss.tvm.ai/t/error-reporting/7793.
---------------------------------------------------------------
Check failed: !checked_type.defined() == false: Expected Array[PrimExpr],
but got Array[index 0: relay.Constant]
```
I found that if the PT graph has aten::Int as the input value for either
strides or pool_size, then we get above.
```
%125 : int = aten::Int(%124)
%126 : int[] = prim::ListConstruct(%116, %119)
%127 : int[] = prim::ListConstruct(%122, %125)
%128 : int[] = prim::ListConstruct(%111, %111)
%x.6 : Tensor = aten::avg_pool2d(%x.5, %126, %127, %128, %108, %107, %106)
```
This fixes that case by converting relay constants to ints. @masahi
----------------------------------------------------------------
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]