diff options
author | Jingyue Wu <jingyue@google.com> | 2017-12-20 08:34:54 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-12-20 11:50:00 -0800 |
commit | 0543cf17187f6d3b178717bd528af28c754aaf94 (patch) | |
tree | 02abf0a8e9fbc155f0523089aa718d0d31775400 /tensorflow/contrib/memory_stats | |
parent | a46e5ae7a9d2d9d7187decf7663d31e77ca2b5c2 (diff) |
Fix a flaky test.
In the old code, `a` can be freed before bytes_in_use, making the result of
`bytes_in_use` unstable. In the new code, `b` uses `a` and control-depends on
`bytes_in_use`, so `a` cannot be freed before `bytes_in_use`.
PiperOrigin-RevId: 179690026
Diffstat (limited to 'tensorflow/contrib/memory_stats')
-rw-r--r-- | tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py b/tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py index d1b430b803..5e52ef3647 100644 --- a/tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py +++ b/tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py @@ -76,9 +76,9 @@ class MemoryStatsOpsTest(test_util.TensorFlowTestCase): with ops.control_dependencies([a]): bytes_in_use_op = memory_stats_ops.BytesInUse() with ops.control_dependencies([bytes_in_use_op]): - b = random_ops.random_uniform(matrix_shape, dtype=dtype) + b = math_ops.add(a, a) - _, bytes_in_use, max_bytes_in_use = sess.run([a, bytes_in_use_op, + _, bytes_in_use, max_bytes_in_use = sess.run([b, bytes_in_use_op, max_bytes_in_use_op]) # intermediate result allocates 1 matrix, max usage is at least 2 |