标签:glob type var nbsp span variables color pre [1]
tf.trainable_variables() 返回的是 所有需要训练的变量列表
tf.all_variables() 返回的是 所有变量的列表
v = tf.Variable(0, name=‘v‘) v1 = tf.Variable(tf.constant(5, shape=[1], dtype=tf.float32), name=‘v1‘) global_step = tf.Variable(6, name=‘global_step‘, trainable=False) # 声明不是训练变量 for ele1 in tf.trainable_variables(): print(ele1.name) print(‘*‘*10) for ele2 in tf.all_variables(): print(ele2.name)
输出
v:0 v1:0 ********** v:0 v1:0 global_step:0
tf.trainable_variables() and tf.all_variables()
标签:glob type var nbsp span variables color pre [1]
原文地址:https://www.cnblogs.com/yanshw/p/10518253.html