Issue with static tensor array

Trying to import a model to TVM but getting follow errors any idea about this

unable to unify: static_tensor_float32_1_256_t and static_tensor_float32_scalar_t;

Can you provide the full trace? Also it should be related to certain tensor array op. It would be better if you can provide a minimal case.

some thing like this

%while_loop(0, 0, %255, %256, %259, %lstm_1/strided_slice_5/_25__cf__25, %lstm_1/strided_slice_10/_20__cf__20, %lstm_1/strided_slice_4/_24__cf__24, %lstm_1/strided_slice_3/_23__cf__23, %258, %lstm_1/strided_slice_1/_19__cf__19, %264, %lstm_1/strided_slice_2/_22__cf__22, %lstm_1/strided_slice_6/_26__cf__26, %lstm_1/strided_slice_11/_21__cf__21, %lstm_1/strided_slice_8/_28__cf__28, %lstm_1/strided_slice_7/_27__cf__27, %lstm_1/strided_slice_9/_29__cf__29, %lstm_1/strided_slice/_18__cf__18, %265) unable to unify: static_tensor_float32_scalar_t and static_tensor_float32_1_256_t; ) unable to unify: static_tensor_float32_1_256_t and static_tensor_float32_scalar_t; ; %266.4

I think I’m facing the same error.

First, I merged the code from Dynamic NMS and strided_slice to support importing model TensorFlow model: ssd_resnet_50_fpn_coco

Then I met the following error:

Traceback (most recent call last):

File “/incubator-tvm/tutorials/ssd_resnet34_tf.py”, line 37, in mod, params = relay.frontend.from_tensorflow(graph_def, layout=layout)

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 3344, in from_tensorflow mod, params = g.from_tensorflow(graph, layout, shape, outputs)

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 2907, in from_tensorflow self._backtrack_construct(node.name)

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 3284, in _backtrack_construct self._control_flow_node_map)

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 3170, in _convert_control_flow_operator op = self._backtrack_construct(node.input[0])

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 3291, in _backtrack_construct in_op = self._backtrack_construct(iname)

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 3291, in _backtrack_construct in_op = self._backtrack_construct(iname)

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 3291, in _backtrack_construct in_op = self._backtrack_construct(iname)

[Previous line repeated 94 more times]

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 3300, in _backtrack_construct op = self._convert_operator(node.op, inputs, attr, self._graph)

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 3243, in _convert_operator sym = convert_map[op_name](inputs, attrs, self._params, self._prelude)

File “/incubator-tvm/python/tvm/relay/frontend/tensorflow.py”, line 950, in _impl input_shape = get_tensor_array_shape(inputs[2], dtype_str, prelude)

File “/incubator-tvm/python/tvm/relay/prelude.py”, line 54, in get_tensor_array_shape mod[“main”] = Function([], expr)

File “/incubator-tvm/python/tvm/ir/module.py”, line 74, in setitem return self._add(var, val)

File “/incubator-tvm/python/tvm/ir/module.py”, line 83, in _add _ffi_api.Module_Add(self, var, val, update)

File “/incubator-tvm/python/tvm/_ffi/_ctypes/packed_func.py”, line 216, in call raise get_last_ffi_error()

%17 = strided_slice(%Preprocessor/map/Shape, begin=[0], end=[1], strides=[1]); %18 = squeeze(%17); %19 = @tensor_array_float32_scalar(%18); %20 = @tensor_array_int32_scalar(%18); %21 = @tensor_array_float32_1_1_3(%18); %22 = arange(0, 1, 1, start=meta[relay.Constant][0], stop=meta[relay.Constant][1], step=meta[relay.Constant][2], dtype=“int32”); %23 = cast(%image_tensor, dtype=“float32”); %24 = @tensor_array_unstack_float32_1_1_1_3(%23); %25 = @tensor_array_scatter_float32_1_1_3(%21, %22, %24); %while_loop(%19, %20, 0, %25, %18) ) unable to unify: static_tensor_float32_640_640_3_t and static_tensor_float32_scalar_t; unable to unify: static_tensor_int32_3_t and static_tensor_int32_scalar_t; ; %26.0

Does anyone else met this error before?

you can make it work with static version of layout, i think something is wrong in loop handling with tensor array.

I’m fixing some issues regarding to tf ssd models and will submit a PR soon.

1 Like

That is nice, wait for approval

I dont think its fixed yet i am having same issues so any update regarding this…

I’m facing the same error.

unable to unify: 'static_tensor_float32_320_320_3_t' and ''static_tensor_float32_scalar_t';
unable to unify: 'static_tensor_int32_3_t' and ''static_tensor_int32_scalar_t';

model: [ssd_mobilenet_v3 (Similar to http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v3_small_coco_2020_01_14.tar.gz)

yap same problem, we may have to wait for new PR

Are you looking at this?

@kevinthesun

I’m refactoring tf frontend tensor array and will fix these issues.

1 Like

Thank you. Looking forward to it.

1 Like