Error export onnx model to tensorflow
ehsanrahnama opened this issue · 0 comments
I have a quantize onnx model and also I want to export to tf and then export to tflite(tensorflow-lite). But unfortunately I face this error.
Could you please help me to convert my model?
Traceback (most recent call last):
File "onnx_export_tf.py", line 25, in
tf_rep.export_graph(tf_model_path)
File "/home/server/w/tmp/onnx-tensorflow/onnx_tf/backend_rep.py", line 143, in export_graph
signatures=self.tf_module.call.get_concrete_function(
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 1264, in get_concrete_function
concrete = self._get_concrete_function_garbage_collected(*args, **kwargs)
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 1244, in _get_concrete_function_garbage_collected
self._initialize(args, kwargs, add_initializers_to=initializers)
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 785, in _initialize
self._stateful_fn._get_concrete_function_internal_garbage_collected( # pylint: disable=protected-access
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2983, in _get_concrete_function_internal_garbage_collected
graph_function, _ = self._maybe_define_function(args, kwargs)
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3292, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3130, in _create_graph_function
func_graph_module.func_graph_from_py_func(
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 1161, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 677, in wrapped_fn
out = weak_wrapped_fn().wrapped(*args, **kwds)
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3831, in bound_method_wrapper
return wrapped_fn(*args, **kwargs)
File "/home/server/miniconda3/envs/myenv2/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 1147, in autograph_handler
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:
File "/home/server/w/tmp/onnx-tensorflow/onnx_tf/backend_tf_module.py", line 99, in __call__ *
output_ops = self.backend._onnx_node_to_tensorflow_op(onnx_node,
File "/home/server/w/tmp/onnx-tensorflow/onnx_tf/backend.py", line 347, in _onnx_node_to_tensorflow_op *
return handler.handle(node, tensor_dict=tensor_dict, strict=strict)
File "/home/server/w/tmp/onnx-tensorflow/onnx_tf/handlers/handler.py", line 59, in handle *
return ver_handle(node, **kwargs)
File "/home/server/w/tmp/onnx-tensorflow/onnx_tf/handlers/backend/q_linear_conv.py", line 69, in version_10 *
B = tf.round(B / B_scale)
ValueError: Dimensions must be equal, but are 32 and 12 for '{{node truediv}} = RealDiv[T=DT_FLOAT](Cast_787, mul_385)' with input shapes: [32], [12].