标签:影响 cep pytho const import var python sts 不同
import tensorflow as tf
"""
tf.get_variable()和Variable有很多不同点
* 它们对重名操作的处理不同
* 它们受name_scope的影响不同
"""
a = tf.Variable(3, name="a")
b = tf.Variable(3, name="a")
print(a.name, b.name) # a:0 a_1:0
try:
a = tf.get_variable("b", initializer=tf.constant_initializer(3), shape=1)
b = tf.get_variable("b", initializer=tf.constant_initializer(3), shape=1) # Variable b already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope?
except Exception as ex:
print(ex)
Tensorflow get_variable和Varialbe的区别
标签:影响 cep pytho const import var python sts 不同
原文地址:https://www.cnblogs.com/weiyinfu/p/9572092.html