microsoft/MMdnn

Error when converting inception-v4 from caffe to tensorflow

seanchung2 opened this issue · 1 comments

Hi,

This is my model: link
When I tried to convert it from IR to tensorflow, an error popped out:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/mmdnn/conversion/examples/tensorflow/imagenet_test.py", line 68, in <module>
    tester = TestTF()
  File "/usr/local/lib/python2.7/dist-packages/mmdnn/conversion/examples/tensorflow/imagenet_test.py", line 17, in __init__
    self.input, self.model = self.MainModel.KitModel(self.args.w)
  File "inception_v4.py", line 57, in KitModel
    inception_stem2_7x1_pad = tf.pad(inception_stem2_1x7_relu, paddings = [[0L, 0L], [3L, 3L], [3L, -3L], [0L, 0L]])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1735, in pad
    result = gen_array_ops._pad(tensor, paddings, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 2927, in _pad
    "Pad", input=input, paddings=paddings, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2958, in create_op
    set_shapes_for_outputs(ret)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2209, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2159, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
    require_shape_fn)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Paddings must be non-negative for 'Pad_4' (op: 'Pad') with input shapes: [?,73,73,64], [4,2] and with computed input tensors: input[1] = <[0 0][3 3][3 -3][0 0]>.

Does it mean this model is impossible to convert?
Or is there any wrong with the model?

Thank you.

Hi @seanchung2 ,

Fixed. Thanks very much.