例如:
import tensorflow as tf;
import numpy as np;
import matplotlib.pyplot as plt;
v = tf.Variable(tf.constant(0.0, shape=[1], dtype=tf.float32), name='v')
ema = tf.train.ExponentialMovingAverage(0.99)
# maintain_average_op = ema.apply(tf.all_variables())
a = tf.all_variables()
for ele in a:
print ele.name
输出:
v:0
import tensorflow as tf;
import numpy as np;
import matplotlib.pyplot as plt;
v = tf.Variable(tf.constant(0.0, shape=[1], dtype=tf.float32), name='v')
ema = tf.train.ExponentialMovingAverage(0.99)
maintain_average_op = ema.apply(tf.all_variables())
a = tf.all_variables()
for ele in a:
print ele.name
输出:
v:0
v/ExponentialMovingAverage:0
多了一个变量