tf.io.write_graph
Записывает протокол буфера графа в файл.
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. |
| Возвращает | |
|---|---|
| Путь к выходному файлу протокола буфера. |
© 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/api_docs/python/tf/io/write_graph