Conv2D expects data's shape to be [4294967295,299,299,3], but got [-1,299,299,3]


#1

Hello,
I found similar issue (TVM TF Converter Bug with Inception_v4 network)
basically, error I am experiencing is same error.

I cloned TVM on Jan 9, 2019. (94cc89dab079fa41cade3830e0bcfa12f9703a87)

What I was trying to do is

Error I got (while calling nnvm.compiler.build(…)) is as follows:

File “test1_running_inceptionv3.py”, line 139, in
graph, lib, params = nnvm.compiler.build(sym, shape=shape_dict, target=target, target_host=target_host, dtype=dtype_dict, params=params)
File “/home/eric/dev/tvm/nnvm/python/nnvm/compiler/build_module.py”, line 270, in build
ishape, _ = graph_util.infer_shape(graph, **shape)
File “/home/eric/dev/tvm/nnvm/python/nnvm/compiler/graph_util.py”, line 31, in infer_shape
graph = graph.apply(“InferShape”)
File “/home/eric/dev/tvm/nnvm/python/nnvm/graph.py”, line 234, in apply
check_call(_LIB.NNGraphApplyPasses(self.handle, npass, cpass, ctypes.byref(ghandle)))
File “/home/eric/dev/tvm/nnvm/python/nnvm/_base.py”, line 75, in check_call
raise NNVMError(py_str(_LIB.NNGetLastError()))
nnvm._base.NNVMError: Error in operator InceptionV3/InceptionV3/Conv2d_1a_3x3/Conv2D: [17:55:03] /home/eric/dev/tvm/nnvm/src/top/nn/convolution.cc:122: Operator conv2d(layout=NHWC, use_bias=False, strides=(2L, 2L), channels=32, dilation=(1L, 1L), padding=[0, 0], kernel_size=(3L, 3L), kernel_layout=HWIO, name=InceptionV3/InceptionV3/Conv2d_1a_3x3/Conv2D) expects data’s shape to be [4294967295,299,299,3], but got [-1,299,299,3].

Stack trace returned 10 entries:
[bt] (0) /home/eric/dev/tvm/build/libtvm.so(dmlc::StackTrace[abi:cxx11](unsigned long)+0x1f5) [0x7f14b5114245]
[bt] (1) /home/eric/dev/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x3e) [0x7f14b5114ece]
[bt] (2) /home/eric/dev/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(nnvm::top::Conv2DInferShape(nnvm::NodeAttrs const&, std::vector<nnvm::TShape, std::allocatornnvm::TShape >, std::vector<nnvm::TShape, std::allocatornnvm::TShape >)+0x16c9) [0x7f14b0e325c9]
[bt] (3) /home/eric/dev/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(+0x1174ad) [0x7f14b0d794ad]
[bt] (4) /home/eric/dev/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(+0x118c1a) [0x7f14b0d7ac1a]
[bt] (5) /home/eric/dev/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(+0x119f0a) [0x7f14b0d7bf0a]
[bt] (6) /home/eric/dev/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&)+0x127d) [0x7f14b0d4eebd]
[bt] (7) /home/eric/dev/tvm/nnvm/python/nnvm/…/…/…/build/libnnvm_compiler.so(NNGraphApplyPasses+0x320) [0x7f14b0d2cce0]
[bt] (8) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f14bb881dae]
[bt] (9) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x22f) [0x7f14bb88171f]

In the pb file, InceptionV3/InceptionV3/Conv2d_1a_3x3/Conv2D is the first conv op, of which input shape is [?,299,299,3].

Would you help me how I can run nnvm.compiler.build(…) successfully?
Thank you in advance!


#2

Hi, the following changes on from_tensorflow.py solved the above issue:

  • changed the name of input : “DecodeJpeg/contents” -> “input”
  • type of input tensor “uint8” -> “float32”
  • modified the output array shape “(1, 1008)” -> “(1, 1001)”

There is nothing wrong with from_tensorflow.py. I had to change the code against the new pb file.

Thanks!


#3

Sorry just to clarify, is it a bug of tvm or the pb file itself?


#4

It is not a but but there’s something wrong with my code to handle my pb file.
Since I used different PB file, the name and type of input and the shape of output were different from the one used by from_tensorflow.py. So I modified from_tensorflow.py to work with my pb file. :slight_smile: