I'm trying to convert a TF model created with TF version 1 into TFLite.
The model is given and I have no control over it. It is saved as a saved_model (.pb).
I tried many ways to convert it to TFLite, using almost all the TFLiteConverter.from_xxx
functions. All of them give me the same error, so I copy here the simplest code, which uses concrete_functions.
Although the model was built and saved with TF1, I must use TF2 for conversion because the model uses operations of control flow v1, which are not supported in TFLite. The only way out that I found is the conversion to control flow v2. It is an NMT model, thus it is sequence-to-sequence: variable-length input and output, which makes things more difficult with TFLite.
This is the full code I used for conversion:
import os
import tensorflow as tf
from tensorflow.core.protobuf import meta_graph_pb2
export_dir = os.path.join('export_dir', '0')
if not os.path.exists('export_dir'):
os.mkdir('export_dir')
tf.compat.v1.enable_control_flow_v2()
def wrap_frozen_graph(graph_def, inputs, outputs):
def _imports_graph_def():
tf.compat.v1.import_graph_def(graph_def, name="")
wrapped_import = tf.compat.v1.wrap_function(_imports_graph_def, [])
import_graph = wrapped_import.graph
return wrapped_import.prune(
inputs, outputs)
graph_def = tf.compat.v1.GraphDef()
loaded = graph_def.ParseFromString(open(os.path.join(export_dir, 'saved_model.pb'),'rb').read())
concrete_func = wrap_frozen_graph(
graph_def, inputs=['extern_data/placeholders/data/data:0', 'extern_data/placeholders/data/data_dim0_size:0'],
outputs='output/output_batch_major:0')
converter = tf.lite.TFLiteConverter.from_concrete_functions([concrete_func])
converter.experimental_new_converter = True
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS,
tf.lite.OpsSet.SELECT_TF_OPS]
converter.allow_custom_ops=True
tflite_model = converter.convert()
And it generates the following error:
2020-10-05 11:53:27.853181: I tensorflow/core/grappler/clusters/single_machine.cc:356] Starting new session
2020-10-05 11:53:27.943922: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:816] Optimization results for grappler item: graph_to_optimize
2020-10-05 11:53:27.943969: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:818] function_optimizer: function_optimizer did nothing. time = 0.007ms.
2020-10-05 11:53:27.943978: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:818] function_optimizer: function_optimizer did nothing. time = 0.001ms.
2020-10-05 11:53:31.350451: W tensorflow/compiler/mlir/lite/python/tf_tfl_flatbuffer_helpers.cc:313] Ignored output_format.
2020-10-05 11:53:31.350505: W tensorflow/compiler/mlir/lite/python/tf_tfl_flatbuffer_helpers.cc:316] Ignored drop_control_dependency.
loc(callsite("output/rec/while/LoopCond"("/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/python/eager/lift_to_graph.py":339:0) at callsite("/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py":338:0 at callsite("/path/to/tools/ckpt2pb.py":30:0 at
"/path/to/tools/ckpt2pb.py":40:0)))): error: body function result type tensor<?x4xf32> is incompatible with result type tensor<?x1xf32> at index 21
Traceback (most recent call last):
File "/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/lite/python/convert.py", line 199, in toco_convert_protos
enable_mlir_converter)
File "/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/lite/python/wrap_toco.py", line 38, in wrapped_toco_convert
enable_mlir_converter)
Exception: /my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/python/eager/lift_to_graph.py:339:0: error: body function result type tensor<?x4xf32> is incompatible with result type tensor<?x1xf32> at index 21
/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py:338:0: note: called from
/my/path/bin//tflite-toolkit/tools/ckpt2pb.py:30:0: note: called from
/my/path/bin//tflite-toolkit/tools/ckpt2pb.py:40:0: note: called from
/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/python/eager/lift_to_graph.py:339:0: note: see current operation: %1:125 = "tf.While"(%outputs_3626, %outputs_3584, %outputs_1688, %outputs_3710, %outputs_3668, %outputs_3794, %outputs_3752, %outputs_3878, %outputs_3836, %outputs_3962, %outputs_3920, %outputs_4046, %outputs_4004, %o
utputs_2310, %outputs_1572, %outputs_2280, %outputs_2362, %outputs_2148, %outputs_2160, %outputs_2248, %outputs_2260, %outputs_2332, %outputs_2338#1, %outputs_2342#1, %outputs_2278, %outputs_2288, %outputs_1748, %outputs_1760, %outputs_1848, %outputs_1860, %outputs_1948, %outputs_1960, %outputs_2048, %outputs_2060, %outputs_1610, %outputs_1690, %outputs_1692, %
outputs_1694, %outputs_1696, %outputs_1722, %outputs_1720, %outputs_1726, %outputs_1724, %outputs_1728, %outputs_1730, %outputs_1732, %outputs_1762, %outputs_1764, %outputs_1766, %outputs_1790, %outputs_1792, %outputs_1794, %outputs_1796, %outputs_1822, %outputs_1820, %outputs_1826, %outputs_1824, %outputs_1828, %outputs_1830, %outputs_1832, %outputs_1862, %out
puts_1864, %outputs_1866, %outputs_1890, %outputs_1892, %outputs_1894, %outputs_1896, %outputs_1922, %outputs_1920, %outputs_1926, %outputs_1924, %outputs_1928, %outputs_1930, %outputs_1932, %outputs_1962, %outputs_1964, %outputs_1966, %outputs_1990, %outputs_1992, %outputs_1994, %outputs_1996, %outputs_2022, %outputs_2020, %outputs_2026, %outputs_2024, %outputs_2028, %outputs_2030, %outputs_2032, %outputs_2062, %outputs_2064, %outputs_2066, %outputs_2090, %outputs_2092, %outputs_2094, %outputs_2096, %outputs_2122, %outputs_2120, %outputs_2126, %outputs_2124, %outputs_2128, %outputs_2130, %outputs_2132, %outputs_2162, %outputs_2164, %outputs_2166, %outputs_2190, %outputs_2192, %outputs_2194, %outputs_2196, %outputs_2222, %outputs_2220, %outputs_2226, %outputs_2224, %outputs_2228, %outputs_2230, %outputs_2232, %outputs_2262, %outputs_2264, %outputs_2266, %outputs_2268, %outputs_2270, %outputs_2334, %outputs_2344, %outputs_2338#0, %outputs_2342#0) {body = @_functionalize_body_10, cond = @_functionalize_cond_10, device = "", is_stateless = false, output_shapes = [], parallel_iterations = 10 : i64} : (tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?xi1>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<22526xf32>, tensor<i32>, tensor<i32>, tensor<?x512xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x1xf32>, tensor<f32>, tensor<f32>, tensor<?xi1>, tensor<?xi32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<i32>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x22526xf32>>>, tensor<!tf.resource<tensor<22526x512xf32>>>, tensor<2x!tf.resource<tensor<?x4xi32>>>, tensor<2x!tf.resource<tensor<?xi32>>>) -> (tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?xi1>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<22526xf32>, tensor<i32>, tensor<i32>, tensor<?x512xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x1xf32>, tensor<f32>, tensor<f32>, tensor<?xi1>, tensor<?xi32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<i32>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<2x!tf.resource>, tensor<2x!tf.resource>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/path/to/tools/ckpt2pb.py", line 51, in <module>
tflite_model = converter.convert()
File "/home/mdigangi/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/lite/python/lite.py", line 1076, in convert
return super(TFLiteConverterV2, self).convert()
File "/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/lite/python/lite.py", line 900, in convert
self).convert(graph_def, input_tensors, output_tensors)
File "/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/lite/python/lite.py", line 633, in convert
**converter_kwargs)
File "/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/lite/python/convert.py", line 574, in toco_convert_impl
enable_mlir_converter=enable_mlir_converter)
File "/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/lite/python/convert.py", line 202, in toco_convert_protos
raise ConverterError(str(e))
tensorflow.lite.python.convert.ConverterError: /my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/python/eager/lift_to_graph.py:339:0: error: body function result type tensor<?x4xf32> is incompatible with result type tensor<?x1xf32> at index 21
/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py:338:0: note: called from
/path/to/tools/ckpt2pb.py:30:0: note: called from
/path/to/tools/ckpt2pb.py:40:0: note: called from
/my/path/environments/venv-tflite2/lib/python3.6/site-packages/tensorflow/python/eager/lift_to_graph.py:339:0: note: see current operation: %1:125 = "tf.While"(%outputs_3626, %outputs_3584, %outputs_1688, %outputs_3710, %outputs_3668, %outputs_3794, %outputs_3752, %outputs_3878, %outputs_3836, %outputs_3962, %outputs_3920, %outputs_4046, %outputs_4004, %outputs_2310, %outputs_1572, %outputs_2280, %outputs_2362, %outputs_2148, %outputs_2160, %outputs_2248, %outputs_2260, %outputs_2332, %outputs_2338#1, %outputs_2342#1, %outputs_2278, %outputs_2288, %outputs_1748, %outputs_1760, %outputs_1848, %outputs_1860, %outputs_1948, %outputs_1960, %outputs_2048, %outputs_2060, %outputs_1610, %outputs_1690, %outputs_1692, %outputs_1694, %outputs_1696, %outputs_1722, %outputs_1720, %outputs_1726, %outputs_1724, %outputs_1728, %outputs_1730, %outputs_1732, %outputs_1762, %outputs_1764, %outputs_1766, %outputs_1790, %outputs_1792, %outputs_1794, %outputs_1796, %outputs_1822, %outputs_1820, %outputs_1826, %outputs_1824, %outputs_1828, %outputs_1830, %outputs_1832, %outputs_1862, %outputs_1864, %outputs_1866, %outputs_1890, %outputs_1892, %outputs_1894, %outputs_1896, %outputs_1922, %outputs_1920, %outputs_1926, %outputs_1924, %outputs_1928, %outputs_1930, %outputs_1932, %outputs_1962, %outputs_1964, %outputs_1966, %outputs_1990, %outputs_1992, %outputs_1994, %outputs_1996, %outputs_2022, %outputs_2020, %outputs_2026, %outputs_2024, %outputs_2028, %outputs_2030, %outputs_2032, %outputs_2062, %outputs_2064, %outputs_2066, %outputs_2090, %outputs_2092, %outputs_2094, %outputs_2096, %outputs_2122, %outputs_2120, %outputs_2126, %outputs_2124, %outputs_2128, %outputs_2130, %outputs_2132, %outputs_2162, %outputs_2164, %outputs_2166, %outputs_2190, %outputs_2192, %outputs_2194, %outputs_2196, %outputs_2222, %outputs_2220, %outputs_2226, %outputs_2224, %outputs_2228, %outputs_2230, %outputs_2232, %outputs_2262, %outputs_2264, %outputs_2266, %outputs_2268, %outputs_2270, %outputs_2334, %outputs_2344, %outputs_2338#0, %outputs_2342#0) {body = @_functionalize_body_10, cond = @_functionalize_cond_10, device = "", is_stateless = false, output_shapes = [], parallel_iterations = 10 : i64} : (tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?xi1>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<22526xf32>, tensor<i32>, tensor<i32>, tensor<?x512xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x1xf32>, tensor<f32>, tensor<f32>, tensor<?xi1>, tensor<?xi32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<i32>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<2048xf32>>>, tensor<!tf.resource<tensor<512x2048xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<2048x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x1536xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512xf32>>>, tensor<!tf.resource<tensor<512x22526xf32>>>, tensor<!tf.resource<tensor<22526x512xf32>>>, tensor<2x!tf.resource<tensor<?x4xi32>>>, tensor<2x!tf.resource<tensor<?xi32>>>) -> (tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?xi1>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<?x?x8x64xf32>, tensor<22526xf32>, tensor<i32>, tensor<i32>, tensor<?x512xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x1xf32>, tensor<f32>, tensor<f32>, tensor<?xi1>, tensor<?xi32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<?x8x0x64xf32>, tensor<i32>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<!tf.resource>, tensor<2x!tf.resource>, tensor<2x!tf.resource>)
I'm now trying to debug this. As the first error is:
/lift_to_graph.py:339:0: error: body function result type tensor<?x4xf32> is incompatible with result type tensor<?x1xf32> at index 21
my question is: how can I find which node is represented by index 21? But also, if you have suggestions about what I can do to figure the problem out, they are very welcome. Final note: It is strange that I get a dimensionality error during conversion, because I can use the same model for translating.