[SOLVED] Question about keras MobilenetV2 model

hello everyone!
I have tried to convert keras mobilenetv2 model into tvm using

sym, params = nnvm.frontend.from_keras(keras_mbnv2)

and it worked, but when I compiled it, there were some errors which I dont know how to solve.

graph, lib, params = nnvm.compiler.build(sym, target, shape_dict, params=params)


NNVMError: [10:21:45] /home/kk/tvm/nnvm/src/compiler/simplify_inference.cc:27: Check failed: dshape.ndim() != 0 (0 vs. 0)

Stack trace returned 10 entries:
[bt] (0) /home/kk/tvm/build/libtvm.so(dmlc::StackTraceabi:cxx11+0x5b) [0x7f52b9307b0b]
[bt] (1) /home/kk/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x28) [0x7f52b93083b8]
[bt] (2) /home/kk/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(nnvm::compiler::BatchNormToInferUnpack(nnvm::NodeAttrs const&, nnvm::NodeEntry, nnvm::NodeEntry, nnvm::NodeEntry, nnvm::NodeEntry, nnvm::NodeEntry, nnvm::TShape, nnvm::TShape)+0x1396) [0x7f52a1a01296]
[bt] (3) /home/kk/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(+0x15fd52) [0x7f52a1a01d52]
[bt] (4) /home/kk/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(+0x160ea2) [0x7f52a1a02ea2]
[bt] (5) /home/kk/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(nnvm::compiler::SimplifyInference(nnvm::Graph)+0x32b) [0x7f52a1a03a3b]
[bt] (6) /home/kk/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(std::_Function_handler<nnvm::Graph (nnvm::Graph), nnvm::Graph (*)(nnvm::Graph)>::_M_invoke(std::_Any_data const&, nnvm::Graph&&)+0x110) [0x7f52a19b6d60]
[bt] (7) /home/kk/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(nnvm::ApplyPasses(nnvm::Graph, std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > const&)+0x32b) [0x7f52a19b0a1b]
[bt] (8) /home/kk/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(NNGraphApplyPasses+0x348) [0x7f52a1988f98]
[bt] (9) /home/kk/miniconda3/envs/dl35/lib/python3.5/lib-dynload/…/…/libffi.so.6(ffi_call_unix64+0x4c) [0x7f5367c7dec0]

could anyone help me? thanks

I solved it, the keras model must be compiled before load_weights, and then there will be no errors

1 Like