|
25 | 25 |
|
26 | 26 | class MovingAveragesTest(tf.test.TestCase):
|
27 | 27 |
|
28 |
| - def testAssignMovingAverage(self): |
| 28 | + def testAssignMovingAverageWithoutZeroDebias(self): |
29 | 29 | with self.test_session():
|
30 | 30 | var = tf.Variable([10.0, 11.0])
|
31 | 31 | val = tf.constant([1.0, 2.0], tf.float32)
|
32 | 32 | decay = 0.25
|
33 |
| - assign = moving_averages.assign_moving_average(var, val, decay) |
| 33 | + assign = moving_averages.assign_moving_average( |
| 34 | + var, val, decay, zero_debias=False) |
34 | 35 | tf.global_variables_initializer().run()
|
35 | 36 | self.assertAllClose([10.0, 11.0], var.eval())
|
36 | 37 | assign.op.run()
|
37 | 38 | self.assertAllClose([10.0 * 0.25 + 1.0 * (1.0 - 0.25),
|
38 | 39 | 11.0 * 0.25 + 2.0 * (1.0 - 0.25)],
|
39 | 40 | var.eval())
|
40 | 41 |
|
41 |
| - def testAssignMovingAverageWithZeroDebias(self): |
| 42 | + def testAssignMovingAverage(self): |
42 | 43 | with self.test_session():
|
43 | 44 | var = tf.Variable([0.0, 0.0])
|
44 | 45 | val = tf.constant([1.0, 2.0], tf.float32)
|
45 | 46 | decay = 0.25
|
46 |
| - assign = moving_averages.assign_moving_average( |
47 |
| - var, val, decay, zero_debias=True) |
| 47 | + assign = moving_averages.assign_moving_average(var, val, decay) |
48 | 48 | tf.global_variables_initializer().run()
|
49 | 49 | self.assertAllClose([0.0, 0.0], var.eval())
|
50 | 50 | assign.op.run()
|
@@ -293,8 +293,8 @@ def testAverageVariablesDeviceAssignment(self):
|
293 | 293 | with tf.device("/job:dev_v0"):
|
294 | 294 | v0 = tf.Variable(10.0, name="v0")
|
295 | 295 | with tf.device("/job:dev_v1"):
|
296 |
| - v1 = gen_state_ops._variable(shape=[1], dtype=tf.float32, |
297 |
| - name="v1", container="", shared_name="") |
| 296 | + v1 = gen_state_ops._variable(shape=[1], dtype=tf.float32, |
| 297 | + name="v1", container="", shared_name="") |
298 | 298 | v1.set_shape([1])
|
299 | 299 | tensor2 = v0 + v1
|
300 | 300 | ema = tf.train.ExponentialMovingAverage(0.25, name="foo_avg")
|
|
0 commit comments