Ruo*_*ong 8 import export neural-network python-3.5 tensorflow
我正在使用Tensorflow 0.8和Python 3.我正在尝试训练神经网络,目标是每50次迭代自动导出/导入网络状态.问题是,当我在第一次迭代中导出的输出张量,输出张名字['Neg:0', 'Slice:0'],但是当我在第二次迭代导出输出张量,输出张量名称更改为['import/Neg:0', 'import/Slice:0'],并导入此输出张量没有那么工作:
ValueError: Specified colocation to an op that does not exist during import: import/Variable in import/Variable/read
Run Code Online (Sandbox Code Playgroud)
我想知道是否有人对此问题有任何想法.谢谢!!!
就是这样tf.import_graph_def工作的。
如果您不需要前缀,只需将name参数设置为空字符串,如下例所示。
# import the model into the current graph
with tf.Graph().as_default() as graph:
const_graph_def = tf.GraphDef()
with open(TRAINED_MODEL_FILENAME, 'rb') as saved_graph:
const_graph_def.ParseFromString(saved_graph.read())
# replace current graph with the saved graph def (and content)
# name="" is important because otherwise (with name=None)
# the graph definitions will be prefixed with import.
# eg: the defined operation FC2/unscaled_logits:0
# will be import/FC2/unscaled_logits:0
tf.import_graph_def(const_graph_def, name="")
[...]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
451 次 |
| 最近记录: |