Hi, I am trying to use LSTM model with TVM however, unfortunately I am facing below issue:
Error I got:
“The following operators are not implemented: {}”.format(missing_operators) NotImplementedError: The following operators are not implemented: {‘TensorListFromTensor’, ‘TensorListSetItem’, ‘TensorListReserve’, ‘TensorListGetItem’, ‘TensorListStack’}
I am getting this error for the code:
relay_func, relay_params = tvm.relay.frontend.from_tensorflow(graph_def, shape={'input': input_shape})
And my full code is given below:
import tvm
import tensorflow as tf
def wrap_frozen_graph(graph_def, inputs, outputs, print_graph=False):
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(
tf.nest.map_structure(import_graph.as_graph_element, inputs),
tf.nest.map_structure(import_graph.as_graph_element, outputs))
input_shape = (1, 1)
frozen_model_dir = '/path/to/frozen/model/'
with tf.io.gfile.GFile(frozen_model_dir+"simple_frozen_graph.pb", "rb") as f:
graph_def = tf.compat.v1.GraphDef()
loaded = graph_def.ParseFromString(f.read())
frozen_func = wrap_frozen_graph(graph_def=graph_def,
inputs=["x:0"],
outputs=["Identity:0"],
print_graph=True)
model = frozen_func
input_tensor = tf.keras.Input(dtype=tf.dtypes.float32, shape=input_shape, name='input')
relay_func, relay_params = tvm.relay.frontend.from_tensorflow(graph_def, shape={'input': input_shape})
target = tvm.target.create('llvm')
with tvm.transform.PassContext(opt_level=3):
graph, lib, params = tvm.relay.build(relay_func, target, params=relay_params)
module = tvm.runtime.create(graph, lib, tvm.cpu(0))
print('module = ', module)
Anyone can please help me with this issue. Thanks in advance.
I am using Tensorflow 2.8.0, Python 3.7.16, and TVM 0.12.dev0 on Ubuntu 20.04