tensorrt icon indicating copy to clipboard operation
tensorrt copied to clipboard

Problem transforming tensorflow model to tensorrt

Open Some-random opened this issue 4 years ago • 1 comments

We're having issue transforming tensorflow model (with embedding) to try. But the following error occurred.

File "/home/research/jiangdongwei/miniconda3/envs/cuda11/lib/python3.6/site-packages/tensorflow/python/compiler/tensorrt/trt_convert.py", line 1108, in convert
    self._converted_graph_def = self._run_conversion(grappler_meta_graph_def)
  File "/home/research/jiangdongwei/miniconda3/envs/cuda11/lib/python3.6/site-packages/tensorflow/python/compiler/tensorrt/trt_convert.py", line 1042, in _run_conversion
    grappler_session_config, meta_graph_def, graph_id=b"tf_graph")
  File "/home/research/jiangdongwei/miniconda3/envs/cuda11/lib/python3.6/site-packages/tensorflow/python/grappler/tf_optimizer.py", line 58, in OptimizeGraph
    graph_id, strip_default_attributes)
tensorflow.python.framework.errors_impl.InvalidArgumentError: input resource[0] expected type resource != float, the type of while_cond_1_y_net_embedding_embedding_lookup_317210[0]
	In {{node while/cond_1/y_net/embedding/embedding_lookup

It seems to indicate we should pass a float variable to tf.keras.layers.embedding but the input to embedding layer should be integers...

Some-random avatar Mar 30 '21 08:03 Some-random

I have met a similar problem when I use TF-TRT and saved_model_cli to convert a saved model. These two methods failed when using Embedding layer. https://stackoverflow.com/questions/67085221/failed-to-use-tf-trt-when-using-tf-keras-layers-embedding

Damcy avatar Apr 14 '21 11:04 Damcy