All the similar questions point out to the fact that w1 should be a tf.Variable type and that seems to be the case here, according to the output of tf.global_variables().推荐答案以下代码将起作用.使用 get_variablefollowing code would work. best way to use get_variablew1 = tf.get_variable("FF_NN/Model/hidden_layer_1/weights/Variable:0")sess.run(tf.assign(w1, w1+50))目前这一步不起作用,这是 tensorflow 中的一个错误 https://github.com/tensorflow/tensorflow/issues/1325FOR now this step won't work, this is a bug in tensorflow https://github.com/tensorflow/tensorflow/issues/1325一个可行的解决方案:w1 = [v for v in tf.global_variables() if v.name=="FF_NN/Model/hidden_layer_1/weights/Variable:0"][0]sess.run(tf.assign(w1, w1+50)) 这篇关于无法为从图中加载的张量变量赋值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-12 16:19