Relax frontend Reshape issue

I’m trying to load onnx model with relax.from_onnx() with the latest unity branch(c0b8953), got the following error while constructing the Reshape node, dose anyone met it before? and perhaps solution?

    5: tvm::relax::Normalizer::Normalize(tvm::RelayExpr const&)
          at /path/tvm/src/relax/ir/block_builder.cc:468
    4: tvm::relax::Normalizer::VisitExpr(tvm::RelayExpr const&)
          at /path/tvm/src/relax/ir/block_builder.cc:544
    3: tvm::relax::Normalizer::VisitExpr_(tvm::relax::CallNode const*)
          at /path/tvm/src/relax/ir/block_builder.cc:599
    2: tvm::relax::Normalizer::InferStructInfo(tvm::relax::Call const&)
          at /path/tvm/src/relax/ir/block_builder.cc:757
    1: tvm::relax::InferStructInfoReshape(tvm::relax::Call const&, tvm::relax::BlockBuilder const&)
          at /path/tvm/src/relax/op/tensor/manipulate.cc:823
    0: tvm::relax::BlockBuilderImpl::ReportFatal(tvm::Diagnostic const&)
          at /path/tvm/src/relax/ir/block_builder.cc:138
    File "/path/tvm/src/relax/ir/block_builder.cc", line 138
    TVMError: Reshape requires the input new shape to be Shape. However, the given one is relax.TensorStructInfo
    [18:14:48] /path/tvm/src/relax/ir/block_builder.cc:64: Warning: BlockBuilder destroyed with remaining blocks!

in the onnx graph the reshape op’ input is relax.Call, one is relax.add, the other is relax.concat()

That might be an issue of the ONNX frontend, it’s not hard to fix it in the file https://github.com/apache/tvm/blob/unity/python/tvm/relax/frontend/onnx/onnx_frontend.py

1 Like