TypeError: int() argument must be a string, a bytes-like object or a number, not 'Any'

Hi, when I import ssd resnet34 into tvm (latest version), got the error below:

TypeError: int() argument must be a string, a bytes-like object or a number, not ‘Any’

ERROR occurred in python/tvm/relay/fronted/tensorflow_ops.py:

def _stridedSlice() … … ret = _op.reshape(out, newshape=tuple(final_output))

Questions are: does this error means tvm cannot support dynamic stridedSlice operator right now? whether tvm can run ssdresnet34 tensorflow model now?

thanks

Traceback (most recent call last):
  File "./lxch_test_tf_onnx__mlperf_ssdresnet34.py", line 361, in <module>
    enable_xtcl_save_so, enable_xtcl_load_so, lib_file, json_file, params_file)
  File "./lxch_test_tf_onnx__mlperf_ssdresnet34.py", line 137, in xtcl_run
    mod, params = relay.frontend.from_tensorflow(graph_def, layout=layout, shape={input_name[0]:(relay.Any(), 3, 1200, 1200)})
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1263, in from_tensorflow
    mod, params = g.from_tensorflow(graph, layout, shape, outputs)
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 659, in from_tensorflow
    func = self._get_relay_func(graph, layout=layout, shape=shape, outputs=outputs)
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 619, in _get_relay_func
    self._backtrack_construct(node.name)
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1130, in _backtrack_construct
    node, [], attr, self._control_flow_node_map
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 865, in _convert_control_flow_operator
    op = self._licm_construct(plname, node.input[0])
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1068, in _licm_construct
    actual_expr = self._backtrack_construct(node_name)
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1160, in _backtrack_construct
    converted = self._backtrack_construct(name)
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in _backtrack_construct
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in <listcomp>
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in _backtrack_construct
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in <listcomp>
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in _backtrack_construct
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in <listcomp>
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in _backtrack_construct
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in <listcomp>
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in _backtrack_construct
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in <listcomp>
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in _backtrack_construct
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1137, in <listcomp>
    inputs = [self._backtrack_construct(iname) for iname in node.input]
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1182, in _backtrack_construct
    op = self._convert_operator(node.op, node.name, inputs, attr)
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow.py", line 1025, in _convert_operator
    sym = convert_map[op_name](inputs, attrs, self._params, self._mod)
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/frontend/tensorflow_ops.py", line 2290, in _impl
    print(attr)
  File "/workspace/1104-mlperf/tvm-official/tvm/python/tvm/relay/op/transform.py", line 245, in reshape
    tempshape.append(int(shape))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'Any'

If you give me the script you are running and model I can help out.

This is likely due to reshape not supporting dynamic shape but there are probably several workarounds.

Hi, thanks for your reply.

the tensorflow model is from https://zenodo.org/record/3345892/files/tf_ssd_resnet34_22.1.zip?download=1 in page : https://github.com/mlcommons/inference/tree/master/vision/classification_and_detection

actually, the script is simple like below:

with tf.gfile.FastGFile(model_path, 'rb') as f:
            graph_def = tf.compat.v1.GraphDef()
            graph_def.ParseFromString(f.read())
            graph = tf.import_graph_def(graph_def, name='')
            graph_def = tf_testing.ProcessGraphDefParam(graph_def)
            with tf.Session() as sess:
                graph_def = tf_testing.AddShapesToGraphDef(sess, output_name)
    
        mod, params = relay.frontend.from_tensorflow(graph_def, layout=layout, shape={input_name[0]:(relay.Any(), 3, 1200, 1200)})