From 4c90f20c0d371c0fe4db6f045ceb2eda147f56d6 Mon Sep 17 00:00:00 2001 From: Lukas Geiger Date: Tue, 26 May 2020 22:43:28 +0100 Subject: [PATCH] Replace list concatenation with generators for auto control deps --- tensorflow/python/framework/auto_control_deps.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/framework/auto_control_deps.py b/tensorflow/python/framework/auto_control_deps.py index dfe84f14f26..51dcb248b11 100644 --- a/tensorflow/python/framework/auto_control_deps.py +++ b/tensorflow/python/framework/auto_control_deps.py @@ -535,8 +535,10 @@ def _get_resource_inputs(op): # Note: A resource handle that is not written to is treated as read-only. We # don't have a special way of denoting an unused resource. - return ([(t, ResourceType.READ_ONLY) for t in reads] + - [(t, ResourceType.READ_WRITE) for t in writes]) + for t in reads: + yield (t, ResourceType.READ_ONLY) + for t in writes: + yield (t, ResourceType.READ_WRITE) def automatic_control_dependencies(f):