Tensorflow-exporting

提供:Dev Guides
移動先:案内検索

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')