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 2021/01/12 14:52:47 UTC
[GitHub] [tvm] luyaor opened a new issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
luyaor opened a new issue #7262:
URL: https://github.com/apache/tvm/issues/7262
## Description
When compiling following model with TVM, it will crash.
The model(with ONNX as frontend) with error is as follows, check bug.onnx in [bug6.zip](https://github.com/apache/tvm/files/5802832/bug6.zip).
![image](https://user-images.githubusercontent.com/7541296/104329942-7d0d2b80-5528-11eb-83dc-ac3f77e30936.png)
The corresponding relay program:
```
#[version = "0.0.5"]
def @main(%node1: Tensor[(4, 8), float32], %node2: Tensor[(8, 5), float32], %node3: Tensor[(4, 5), float32]) {
%0 = nn.batch_flatten(%node1);
%1 = transpose(%node2, axes=[1, 0]);
%2 = nn.dense(%0, %1, units=5);
%3 = multiply(1f, %node3);
nn.bias_add(%2, %3)
}
```
## Error Log
```
tensor type `Tensor[(5), float32]` has 1 dimensions, while `Tensor[(4, 5), float32]` has 2 dimensions
The Relay type checker is unable to show the following types match.
In particular `Tensor[(5), float32]` does not match `Tensor[(4, 5), float32]`
Traceback (most recent call last):
File "check.py", line 19, in <module>
tvm_graph, tvm_lib, tvm_params = relay.build_module.build(mod, target, params=params)
File "/Users/luyaor/Documents/tvm/python/tvm/relay/build_module.py", line 275, in build
graph_json, mod, params = bld_mod.build(mod, target, target_host, params)
File "/Users/luyaor/Documents/tvm/python/tvm/relay/build_module.py", line 138, in build
self._build(mod, target, target_host)
File "/Users/luyaor/Documents/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
raise get_last_ffi_error()
tvm.error.DiagnosticError: Traceback (most recent call last):
[bt] (8) 9 libtvm.dylib 0x000000011a18ab7c tvm::transform::PassNode::operator()(tvm::IRModule) const + 60
[bt] (7) 8 libtvm.dylib 0x000000011a286415 tvm::transform::SequentialNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const + 869
[bt] (6) 7 libtvm.dylib 0x000000011a286792 tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const + 194
[bt] (5) 6 libtvm.dylib 0x000000011a2862fc tvm::transform::SequentialNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const + 588
[bt] (4) 5 libtvm.dylib 0x000000011a286792 tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const + 194
[bt] (3) 4 libtvm.dylib 0x000000011a284f25 tvm::transform::ModulePassNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const + 789
[bt] (2) 3 libtvm.dylib 0x000000011acc53f9 std::__1::__function::__func<void tvm::runtime::TypedPackedFunc<tvm::IRModule (tvm::IRModule, tvm::transform::PassContext)>::AssignTypedLambda<tvm::relay::transform::InferType()::$_1>(tvm::relay::transform::InferType()::$_1)::'lambda'(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*), std::__1::allocator<void tvm::runtime::TypedPackedFunc<tvm::IRModule (tvm::IRModule, tvm::transform::PassContext)>::AssignTypedLambda<tvm::relay::transform::InferType()::$_1>(tvm::relay::transform::InferType()::$_1)::'lambda'(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)>, void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) + 2025
[bt] (1) 2 libtvm.dylib 0x000000011a2440cc tvm::DiagnosticContext::Render() + 476
[bt] (0) 1 libtvm.dylib 0x000000011a017c6f dmlc::LogMessageFatal::~LogMessageFatal() + 111
File "/Users/luyaor/Documents/tvm/src/ir/diagnostic.cc", line 105
DiagnosticError: one or more error diagnostics were emitted, please check diagnostic render for output.
```
## How to reproduce
### Environment
Python3, with tvm, onnx
tvm version: [`c31e338`](https://github.com/apache/tvm/commit/c31e338d5f98a8e8c97286c5b93b20caee8be602) Wed Dec 9 14:52:58 2020 +0900
1. Download [bug6.zip](https://github.com/apache/tvm/files/5802832/bug6.zip)
2. Run `python check.py`.
----------------------------------------------------------------
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
[GitHub] [tvm] luyaor commented on issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
Posted by GitBox <gi...@apache.org>.
luyaor commented on issue #7262:
URL: https://github.com/apache/tvm/issues/7262#issuecomment-765198567
@jwfromm
----------------------------------------------------------------
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
[GitHub] [tvm] AndrewZhaoLuo commented on issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
Posted by GitBox <gi...@apache.org>.
AndrewZhaoLuo commented on issue #7262:
URL: https://github.com/apache/tvm/issues/7262#issuecomment-914534708
I would try upgrading versions, the commit you are using is very old @luyaor. I can't see any obvious errors in the latest TVM either that would cause your error.
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] AndrewZhaoLuo commented on issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
Posted by GitBox <gi...@apache.org>.
AndrewZhaoLuo commented on issue #7262:
URL: https://github.com/apache/tvm/issues/7262#issuecomment-911968074
This is just that our type checker is very tough and we have an edge case. Thanks for bringing this to attention.
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] AndrewZhaoLuo commented on issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
Posted by GitBox <gi...@apache.org>.
AndrewZhaoLuo commented on issue #7262:
URL: https://github.com/apache/tvm/issues/7262#issuecomment-914533472
Hi folks, I've tried this with the latest TVM build on an M1 mac and it appears to work. I don't get the same bug
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] AndrewZhaoLuo commented on issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
Posted by GitBox <gi...@apache.org>.
AndrewZhaoLuo commented on issue #7262:
URL: https://github.com/apache/tvm/issues/7262#issuecomment-914536227
In general I recommend installing from source and keeping an up to date install
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] myproject24 commented on issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
Posted by GitBox <gi...@apache.org>.
myproject24 commented on issue #7262:
URL: https://github.com/apache/tvm/issues/7262#issuecomment-914095600
Hi, @AndrewZhaoLuo @srkreddy1238 @tqchen I am also facing the same error any suggestions?
**shape_dict = {'image': (1, 368, 368, 3)}
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
Traceback (most recent call last):
File "C:\Users\700002~1\AppData\Local\Temp\1/ipykernel_13276/2644513500.py", line 1, in <module>
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 4049, in from_onnx
mod, params = g.from_onnx(graph, opset)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 3813, in from_onnx
op = self._convert_operator(op_name, inputs, attr, opset)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 3942, in _convert_operator
sym = convert_map[op_name](inputs, attrs, self._params)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 433, in _impl_v1
input_shape = infer_shape(data)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\common.py", line 512, in infer_shape
out_type = infer_type(inputs, mod=mod)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\common.py", line 487, in infer_type
new_mod = _transform.InferType()(new_mod)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\ir\transform.py", line 161, in __call__
return _ffi_transform_api.RunPass(self, mod)
File "tvm\_ffi\_cython\./packed_func.pxi", line 323, in tvm._ffi._cy3.core.PackedFuncBase.__call__
File "tvm\_ffi\_cython\./packed_func.pxi", line 257, in tvm._ffi._cy3.core.FuncCall
File "tvm\_ffi\_cython\./packed_func.pxi", line 246, in tvm._ffi._cy3.core.FuncCall3
File "tvm\_ffi\_cython\./base.pxi", line 163, in tvm._ffi._cy3.core.CALL
DiagnosticError: Traceback (most recent call last):
File "C:\Users\7000020787\.conda\envs\tvm-build\conda-bld\tvm-package_1630408977894\work\src\ir\diagnostic.cc", line 105
DiagnosticError: one or more error diagnostics were emitted, please check diagnostic render for output.**
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] myproject24 edited a comment on issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
Posted by GitBox <gi...@apache.org>.
myproject24 edited a comment on issue #7262:
URL: https://github.com/apache/tvm/issues/7262#issuecomment-914095600
Hi, @AndrewZhaoLuo @srkreddy1238 @tqchen I am also facing the same error any suggestions?
**shape_dict = {'image': (1, 368, 368, 3)}
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
Traceback (most recent call last):
File "C:\Users\700002~1\AppData\Local\Temp\1/ipykernel_13276/2644513500.py", line 1, in <module>
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 4049, in from_onnx
mod, params = g.from_onnx(graph, opset)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 3813, in from_onnx
op = self._convert_operator(op_name, inputs, attr, opset)
File "C:\Users\7000020787\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 3942, in _convert_operator
sym = convert_map[op_name](inputs, attrs, self._params)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 433, in _impl_v1
input_shape = infer_shape(data)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\common.py", line 512, in infer_shape
out_type = infer_type(inputs, mod=mod)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\common.py", line 487, in infer_type
new_mod = _transform.InferType()(new_mod)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\ir\transform.py", line 161, in __call__
return _ffi_transform_api.RunPass(self, mod)
File "tvm\_ffi\_cython\./packed_func.pxi", line 323, in tvm._ffi._cy3.core.PackedFuncBase.__call__
File "tvm\_ffi\_cython\./packed_func.pxi", line 257, in tvm._ffi._cy3.core.FuncCall
File "tvm\_ffi\_cython\./packed_func.pxi", line 246, in tvm._ffi._cy3.core.FuncCall3
File "tvm\_ffi\_cython\./base.pxi", line 163, in tvm._ffi._cy3.core.CALL
DiagnosticError: Traceback (most recent call last):
File "C:\Users\.conda\envs\tvm-build\conda-bld\tvm-package_1630408977894\work\src\ir\diagnostic.cc", line 105
DiagnosticError: one or more error diagnostics were emitted, please check diagnostic render for output.**
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] myproject24 edited a comment on issue #7262: [Bug] Error when compiling a ONNX model with Gemm operator
Posted by GitBox <gi...@apache.org>.
myproject24 edited a comment on issue #7262:
URL: https://github.com/apache/tvm/issues/7262#issuecomment-914095600
Hi, @AndrewZhaoLuo @srkreddy1238 @tqchen I am also facing the same error any suggestions?
**shape_dict = {'image': (1, 368, 368, 3)}
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
Traceback (most recent call last):
File "C:\Users\AppData\Local\Temp\1/ipykernel_13276/2644513500.py", line 1, in <module>
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
File "C:\User\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 4049, in from_onnx
mod, params = g.from_onnx(graph, opset)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 3813, in from_onnx
op = self._convert_operator(op_name, inputs, attr, opset)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 3942, in _convert_operator
sym = convert_map[op_name](inputs, attrs, self._params)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\onnx.py", line 433, in _impl_v1
input_shape = infer_shape(data)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\common.py", line 512, in infer_shape
out_type = infer_type(inputs, mod=mod)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\relay\frontend\common.py", line 487, in infer_type
new_mod = _transform.InferType()(new_mod)
File "C:\Users\.conda\envs\tvm-build\lib\site-packages\tvm\ir\transform.py", line 161, in __call__
return _ffi_transform_api.RunPass(self, mod)
File "tvm\_ffi\_cython\./packed_func.pxi", line 323, in tvm._ffi._cy3.core.PackedFuncBase.__call__
File "tvm\_ffi\_cython\./packed_func.pxi", line 257, in tvm._ffi._cy3.core.FuncCall
File "tvm\_ffi\_cython\./packed_func.pxi", line 246, in tvm._ffi._cy3.core.FuncCall3
File "tvm\_ffi\_cython\./base.pxi", line 163, in tvm._ffi._cy3.core.CALL
DiagnosticError: Traceback (most recent call last):
File "C:\Users\.conda\envs\tvm-build\conda-bld\tvm-package_1630408977894\work\src\ir\diagnostic.cc", line 105
DiagnosticError: one or more error diagnostics were emitted, please check diagnostic render for output.**
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org