aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/gan
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-04-16 16:15:19 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-16 16:18:08 -0700
commit4f64c4bfb04038459d9551caf018890e2e7d5c41 (patch)
treeac8b0b8c3a9fc5eab15ba8468bbc15bb8d463bb6 /tensorflow/contrib/gan
parentf59a82f2b08dca1641d5766fdd2234d3b665a862 (diff)
Create copy of locals() before copying, since modifying locals does not always affect the values. https://docs.python.org/2/library/functions.html#locals.
PiperOrigin-RevId: 193116254
Diffstat (limited to 'tensorflow/contrib/gan')
-rw-r--r--tensorflow/contrib/gan/python/train.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/contrib/gan/python/train.py b/tensorflow/contrib/gan/python/train.py
index 73acd05b60..6fa43059f3 100644
--- a/tensorflow/contrib/gan/python/train.py
+++ b/tensorflow/contrib/gan/python/train.py
@@ -710,7 +710,10 @@ def gan_train_ops(
be used to train a generator/discriminator pair.
"""
if isinstance(model, namedtuples.CycleGANModel):
- saved_params = locals()
+ # Get and store all arguments other than model and loss from locals.
+ # Contents of locals should not be modified, may not affect values. So make
+ # a copy. https://docs.python.org/2/library/functions.html#locals.
+ saved_params = dict(locals())
saved_params.pop('model', None)
saved_params.pop('loss', None)
kwargs = saved_params.pop('kwargs', {})