Skip to content

Instantly share code, notes, and snippets.

@qinyao-he
qinyao-he / tensorrt.py
Last active June 19, 2020 08:28
Optimize frozen tensorflow graph using TensorRT
import os
import tensorflow as tf
import tensorflow.contrib.tensorrt as trt
def get_frozen_graph(graph_file):
"""Read Frozen Graph file from disk."""
with tf.gfile.FastGFile(graph_file, "rb") as f:
graph_def = tf.GraphDef()