ValueError:至少两个变量具有相同的名称

时间:2019-07-13 11:59:06

标签: python tensorflow

我正在尝试恢复检查点并将其导出为saved_model.pb。为此,我编写了以下代码:

new_graph = tf.Graph()
with tf.Session(graph=new_graph) as sess:
    saver = tf.train.import_meta_graph('./model.ckpt-500.meta',
                                      clear_devices=True)
    saver.restore(sess, './model.ckpt-500')
    inputs = {'inputs': new_graph.get_tensor_by_name('IteratorGetNext:0')}
    outputs = {'outputs': new_graph.get_tensor_by_name('outputs/Softmax:0')}
    tf.saved_model.simple_save(sess, './inference_ckpt_saved_model_1/', inputs, outputs)

但是我无法做到这一点,不断遇到此错误:

At least two variables have the same name: Adam/conv_10/bias/m

基于Github上的this答案,我也创建了一个new_graph

如何解决此错误?您的任何帮助都将不胜感激。

0 个答案:

没有答案