diff --git a/tensorflow/python/training/moving_averages.py b/tensorflow/python/training/moving_averages.py index 0060b58bd7a..eb073438506 100644 --- a/tensorflow/python/training/moving_averages.py +++ b/tensorflow/python/training/moving_averages.py @@ -278,14 +278,12 @@ class ExponentialMovingAverage(object): # Create an ExponentialMovingAverage object ema = tf.train.ExponentialMovingAverage(decay=0.9999) - # Create the shadow variables, and add ops to maintain moving averages - # of var0 and var1. - maintain_averages_op = ema.apply([var0, var1]) - - # Create an op that will update the moving averages after each training - # step. This is what we will use in place of the usual training op. with tf.control_dependencies([opt_op]): - training_op = tf.group(maintain_averages_op) + # Create the shadow variables, and add ops to maintain moving averages + # of var0 and var1. This also creates an op that will update the moving + # averages after each training step. This is what we will use in place + # of the usual training op. + training_op = ema.apply([var0, var1]) ...train the model by running training_op... ```