我正在尝试使用 tensorrt 优化我训练有素的冻结推理图。
https://docs.nvidia.com/deeplearning/dgx/integrate-tf-trt/index.html#using-savedmodel
with tf.Graph().as_default() as tf_graph:
with tf.Session() as tf_sess:
with tf.gfile.GFile(path, 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
infer_graph= trt.create_inference_graph(
graph_def,
outputs=outputs_,
is_dynamic_op=False,
max_workspace_size_bytes=1<<30,
precision_mode='FP16')
Error:
-> 362 transformed_graph_def = tf_optimizer.OptimizeGraph(session_config_with_trt, grappler_meta_graph_def, graph_id=b"tf_graph")
/home/dell/.local/lib/python2.7/site-packages/tensorflow/python/grappler/tf_optimizer.pyc in
-> 41 tf_opt.TF_OptimizeGraph(cluster.tf_cluster,config_proto.SerializeToString(),metagraph.SerializeToString(),verbose, graph_id, status)
/home/dell/.local/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.pyc in __exit__(self, type_arg, value_arg, traceback_arg)
--> 528
c_api.TF_GetCode(self.status.status))
529
# Delete the underlying status object from memory otherwise it stays alive
530
# as there is a reference to status from this from the traceback due to
InvalidArgumentError: Failed to import metagraph, check error log for more info.