# Facing Errors in Compiling Faster R-CNN (ONNX) with Apache TVM

**URL:** <https://discuss.tvm.apache.org/t/facing-errors-in-compiling-faster-r-cnn-onnx-with-apache-tvm/17045>\
**Category:** Troubleshooting\
**Created:** [April 8, 2024, 6:57am UTC](https://discuss.tvm.apache.org/t/facing-errors-in-compiling-faster-r-cnn-onnx-with-apache-tvm/17045 "2024-04-08T06:57:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![janhavi](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/j/f19dbf/32.png) [@janhavi](https://discuss.tvm.apache.org/u/janhavi)\
**Post date:** [April 8, 2024, 6:57am UTC](https://discuss.tvm.apache.org/t/facing-errors-in-compiling-faster-r-cnn-onnx-with-apache-tvm/17045/1 "2024-04-08T06:57:22Z")

</div>

I am facing an error while compiling the Faster R-CNN model with Apache TVM. I am using the onnx file and then while compilation I see the following error (attached below). There is also another similar error that was posted on the forum which remains unanswered: [[Bug][ONNX] Found null pointer node while traversing AST](https://discuss.tvm.apache.org/t/bug-onnx-found-null-pointer-node-while-traversing-ast/14745) Hoping that this gets resolved. Here’s the code and error snippet. Code: !tvmc compile   
–target “llvm”   
–input-shapes “images:[1,3,224,224]”   
–output faster\_rcnn-tvm.tar   
/content/faster\_rcnn.onnx

## Error: Traceback (most recent call last): File “/usr/local/bin/tvmc”, line 8, in sys.exit(main()) File “/usr/local/lib/python3.10/dist-packages/tvm/driver/tvmc/main.py”, line 115, in main sys.exit(\_main(sys.argv[1:])) File “/usr/local/lib/python3.10/dist-packages/tvm/driver/tvmc/main.py”, line 103, in \_main return args.func(args) File “/usr/local/lib/python3.10/dist-packages/tvm/driver/tvmc/compiler.py”, line 174, in drive\_compile tvmc\_model = frontends.load\_model(args.FILE, args.model\_format, args.input\_shapes) File “/usr/local/lib/python3.10/dist-packages/tvm/driver/tvmc/frontends.py”, line 476, in load\_model mod, params = frontend.load(path, shape\_dict, \*_kwargs) File “/usr/local/lib/python3.10/dist-packages/tvm/driver/tvmc/frontends.py”, line 169, in load return relay.frontend.from\_onnx(model, shape=shape\_dict, kwargs) File “/usr/local/lib/python3.10/dist-packages/tvm/relay/frontend/onnx.py”, line 6226, in from\_onnx mod, params = g.from\_onnx(graph, opset) File “/usr/local/lib/python3.10/dist-packages/tvm/relay/frontend/onnx.py”, line 5887, in from\_onnx self.\_construct\_nodes(graph) File “/usr/local/lib/python3.10/dist-packages/tvm/relay/frontend/onnx.py”, line 5999, in \_construct\_nodes op = self.\_convert\_operator(op\_name, inputs, attr, self.opset) File “/usr/local/lib/python3.10/dist-packages/tvm/relay/frontend/onnx.py”, line 6110, in \_convert\_operator sym = convert\_map[op\_name](inputs, attrs, self.\_params) File “/usr/local/lib/python3.10/dist-packages/tvm/relay/frontend/onnx.py”, line 1650, in \_impl\_v11 value = fold\_constant(\_op.take(inputs[2], \_op.const(0))) File “/usr/local/lib/python3.10/dist-packages/tvm/relay/frontend/common.py”, line 511, in fold\_constant return \_transform.FoldConstantExpr(node, mod) File “/usr/local/lib/python3.10/dist-packages/tvm/relay/transform/transform.py”, line 280, in FoldConstantExpr return \_ffi\_api.FoldConstantExpr(expr, mod, fold\_qnn) File “tvm/\_ffi/\_cython/./packed\_func.pxi”, line 331, in tvm.\_ffi.\_cy3.core.PackedFuncBase. **call** File “tvm/\_ffi/\_cython/./packed\_func.pxi”, line 262, in tvm.\_ffi.\_cy3.core.FuncCall File “tvm/\_ffi/\_cython/./packed\_func.pxi”, line 251, in tvm.\_ffi.\_cy3.core.FuncCall3 File “tvm/\_ffi/\_cython/./base.pxi”, line 181, in tvm.\_ffi.\_cy3.core.CHECK\_CALL tvm.\_ffi.base.TVMError: Traceback (most recent call last): 8: TVMFuncCall 7: tvm::runtime::PackedFuncObj::Extractor\<tvm::runtime::PackedFuncSubObj\<tvm::runtime::TypedPackedFunc\<tvm::RelayExpr (tvm::RelayExpr const&, tvm::IRModule const&, bool)\>::AssignTypedLambda\<tvm::relay::transform::{lambda(tvm::RelayExpr const&, tvm::IRModule const&, bool)#1}\>(tvm::relay::transform::{lambda(tvm::RelayExpr const&, tvm::IRModule const&, bool)#1}, std::string)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue)#1}\> \>::Call(tvm::runtime::PackedFuncObj const, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue_) 6: tvm::relay::transform::FoldConstantExpr(tvm::RelayExpr const&, tvm::IRModule const&, bool) 5: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&) 4: void tvm::relay::ExpandDataflow\<tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#1}, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#2}, tvm::relay::ExpandDataflow\<tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#1}, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#2}\>(tvm::RelayExpr, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#1}, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#2})::{lambda(tvm::RelayExpr const&)#1}\>(tvm::RelayExpr, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#1}, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#2}, tvm::relay::ExpandDataflow\<tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#1}, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#2}\>(tvm::RelayExpr, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#1}, tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)::{lambda(tvm::RelayExpr const&)#2})::{lambda(tvm::RelayExpr const&)#1}) [clone .isra.0] 3: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&) 2: \_ZN3tvm5relay16M 1: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&) 0: tvm::relay::ExprFunctor\<void (tvm::RelayExpr const&)\>::VisitExpr(tvm::RelayExpr const&) [clone .part.0] File “/workspace/tvm/include/tvm/relay/expr\_functor.h”, line 92 TVMError:

## An error occurred during the execution of TVM. For more information, please see: [TVM Errors — Apache TVM](https://tvm.apache.org/docs/errors.html)

Check failed: (n.defined()) is false: Found null pointer node while traversing AST. The previous pass may have generated invalid data.

---

<div class="post-metadata">

**Author:** ![janhavi](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/j/f19dbf/32.png) [@janhavi](https://discuss.tvm.apache.org/u/janhavi)\
**Post date:** [April 13, 2024, 5:01am UTC](https://discuss.tvm.apache.org/t/facing-errors-in-compiling-faster-r-cnn-onnx-with-apache-tvm/17045/2 "2024-04-13T05:01:32Z")

</div>

Here are some other necessary details:

1. TVM version: apache-tvm-0.11.1
2. Hardware and OS: Google Colab CPU, Windows
3. Using the LLVM IR as target i.e. “llvm” flag while compiling
4. Model: fasterrcnn\_resnet50\_fpn from torchvision models
5. Input shape: (1, 3, 800,800)

---

<div class="post-metadata">

**Author:** ![guguo](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/g/9dc877/32.png) [@guguo](https://discuss.tvm.apache.org/u/guguo)\
**Post date:** [May 9, 2025, 12:29am UTC](https://discuss.tvm.apache.org/t/facing-errors-in-compiling-faster-r-cnn-onnx-with-apache-tvm/17045/3 "2025-05-09T00:29:23Z")

</div>

你好，我遇到了相同的问题，请问你解决了吗？
