[SOLVED] Resnet18_v1 compilation fails with opt_level=3 on Raspberry Pi 3B+

I’m using the latest tvm/nnvm code to compile resnet18_v1 model on Raspberry Pi 3B+ on python 3.5.3 with opt_level = 3

compilation code: https://gist.github.com/apivovarov/ce2d6dae07f8895c2e2a6cc18870154d

Error:

$ python3 compile.py 
model: resnet18_v1 , target: llvm -device=arm_cpu -model=bcm2837 -target=armv7l-linux-gnueabihf -mattr=+neon , opt_level: 3 , data_shape: (1, 3, 224, 224)
Compiling...
Traceback (most recent call last):
  File "compile.py", line 25, in <module>
    graph, lib, params = nnvm.compiler.build(sym, target, shape={"data": data_shape}, params=params)
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/compiler/build_module.py", line 281, in build
    graph = optimize(graph, shape, dtype, layout)
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/compiler/build_module.py", line 176, in optimize
    graph = graph.apply(["InferShape", "SimplifyInference"])
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/graph.py", line 234, in apply
    check_call(_LIB.NNGraphApplyPasses(self.handle, npass, cpass, ctypes.byref(ghandle)))
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/_base.py", line 75, in check_call
    raise NNVMError(py_str(_LIB.NNGetLastError()))
nnvm._base.NNVMError: Error in operator reshape0: [13:54:09] /home/pi/tvm/nnvm/src/top/tensor/transform.cc:536: Check failed: out_shape.Size() == dshape.Size() (147456 vs. 3516809216) Target shape size is different to source. Target: [6,6,8,8,64]
Source: [2130481686,2130481686,64,64]

Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python3.5/dist-packages/tvm-0.5.dev0-py3.5-linux-armv7l.egg/tvm/libtvm.so(dmlc::StackTrace[abi:cxx11]()+0x138) [0x6e2b6a54]
[bt] (1) /usr/local/lib/python3.5/dist-packages/tvm-0.5.dev0-py3.5-linux-armv7l.egg/tvm/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x30) [0x6e2b7594]
[bt] (2) /usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/libnnvm_compiler.so(nnvm::top::ReshapeInferShape(nnvm::NodeAttrs const&, std::vector<nnvm::TShape, std::allocator<nnvm::TShape> >*, std::vector<nnvm::TShape, std::allocator<nnvm::TShape> >*)+0xb3c) [0x6daa4d84]
[bt] (3) /usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/libnnvm_compiler.so(+0xf5b2c) [0x6d93cb2c]
[bt] (4) /usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/libnnvm_compiler.so(+0xf6ce8) [0x6d93dce8]
[bt] (5) /usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/libnnvm_compiler.so(+0xf7a9c) [0x6d93ea9c]
[bt] (6) /usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/libnnvm_compiler.so(nnvm::ApplyPasses(nnvm::Graph, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)+0x2d0) [0x6d915d58]
[bt] (7) /usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/libnnvm_compiler.so(NNGraphApplyPasses+0x2e8) [0x6d8f94ac]
[bt] (8) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-arm-linux-gnueabihf.so(ffi_call_VFP+0x54) [0x76942a90]
[bt] (9) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-arm-linux-gnueabihf.so(ffi_call+0x12c) [0x76942528]

ok, the solution here is to compile the model for Raspberry PI on regular x86_64 Ubuntu box.