TensorFlow導出

在這裏,將重點關注和學習TensorFlow中的MetaGraph形成。這有助於瞭解TensorFlow中的導出模組。MetaGraph包含基本資訊,這些資訊是對先前訓練過的圖表進行訓練,執行評估或運行推理所必需的。

以下是相同的代碼片段 -

def export_meta_graph(filename = None, collection_list = None, as_text = False):
   """this code writes `MetaGraphDef` to save_path/filename.

   Arguments:
   filename: Optional meta_graph filename including the path. collection_list:
      List of string keys to collect. as_text: If `True`,
      writes the meta_graph as an ASCII proto.

   Returns:
   A `MetaGraphDef` proto. """

下麵是一個典型的使用模型 -

# Build the model ...
with tf.Session() as sess:
   # Use the model ...
# Export the model to /tmp/my-model.meta.
meta_graph_def = tf.train.export_meta_graph(filename = '/tmp/my-model.meta')

上一篇: TensorFlow分佈式計算 下一篇: TensorFlow多層感知器學習