tf.io.write_graph
| View source on GitHub |
Записывает протокол графа в файл.
tf.io.write_graph(
graph_or_graph_def, logdir, name, as_text=True
)
Граф записывается как текстовый протокол, если as_text равно False.
v = tf.Variable(0, name='my_variable') sess = tf.compat.v1.Session() tf.io.write_graph(sess.graph_def, '/tmp/my-model', 'train.pbtxt')
или
v = tf.Variable(0, name='my_variable') sess = tf.compat.v1.Session() tf.io.write_graph(sess.graph, '/tmp/my-model', 'train.pbtxt')
| Аргументы | |
|---|---|
graph_or_graph_def | Graph или GraphDef протокол буфера. |
logdir | Каталог, в который следует записать граф. Это может ссылаться на удаленные файловые системы, такие как Google Cloud Storage (GCS). |
name | Имя файла для графа. |
as_text | Если True, записывает граф как ASCII-протокол. |
| Возвращаемое значение | |
|---|---|
| Путь к выходному файлу proto. |
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/io/write_graph