Skip to content

Commit

Permalink
Fix bug where examples fail with "doesn't work when executing eagerly".
Browse files Browse the repository at this point in the history
Fixes: #29
#31
PiperOrigin-RevId: 322138125
Change-Id: I8569e5d5907cd2e32189729d850cec8db671378c
  • Loading branch information
joel-shor authored and copybara-github committed Jul 20, 2020
1 parent df04841 commit b9c3655
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/cifar/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.cifar import eval_lib

FLAGS = flags.FLAGS
Expand Down Expand Up @@ -66,4 +67,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/cifar/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import flags
from absl import logging

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.cifar import train_lib

# ML Hparams.
Expand Down Expand Up @@ -58,4 +59,5 @@ def main(_):

if __name__ == '__main__':
logging.set_verbosity(logging.INFO)
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/cyclegan/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.cyclegan import train_lib

flags.DEFINE_string('image_set_x_file_pattern', None,
Expand Down Expand Up @@ -63,4 +64,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/mnist/conditional_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.mnist import conditional_eval_lib

flags.DEFINE_string('checkpoint_dir', '/tmp/mnist/',
Expand Down Expand Up @@ -56,4 +57,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/mnist/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.mnist import eval_lib

FLAGS = flags.FLAGS
Expand Down Expand Up @@ -61,4 +62,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/mnist/infogan_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.mnist import infogan_eval_lib

flags.DEFINE_string('checkpoint_dir', '/tmp/mnist/',
Expand Down Expand Up @@ -68,4 +69,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/mnist/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from absl import flags
from absl import logging

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.mnist import train_lib


Expand Down Expand Up @@ -54,4 +55,5 @@ def main(_):

if __name__ == '__main__':
logging.set_verbosity(logging.INFO)
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/mnist_estimator/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.mnist_estimator import train_lib

flags.DEFINE_integer('batch_size', 32,
Expand All @@ -46,4 +47,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/mnist_estimator/train_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.mnist_estimator import train_experiment_lib

# ML Hparams.
Expand Down Expand Up @@ -62,4 +63,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
1 change: 1 addition & 0 deletions tensorflow_gan/examples/progressive_gan/train_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
tf.app.run()
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.self_attention_estimator import train_experiment


Expand Down Expand Up @@ -140,4 +142,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/stargan/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.stargan import train_lib

# FLAGS for data.
Expand Down Expand Up @@ -66,4 +67,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)
2 changes: 2 additions & 0 deletions tensorflow_gan/examples/stargan_estimator/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from absl import app
from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.stargan_estimator import train_lib

# FLAGS for data.
Expand Down Expand Up @@ -69,4 +70,5 @@ def main(_):


if __name__ == '__main__':
tf.disable_v2_behavior()
app.run(main)

0 comments on commit b9c3655

Please sign in to comment.