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:
[email protected]


Reply via email to