From 6df7081e1d618dc36c9d6316ce46baf1d8dac126 Mon Sep 17 00:00:00 2001 From: Yanhua Sun Date: Fri, 14 Feb 2020 13:00:33 -0800 Subject: [PATCH] Explicitly replace "import tensorflow" with "tensorflow.compat.v1" for TF2.x migration PiperOrigin-RevId: 295207815 --- axial/config_imagenet32.py | 2 +- axial/config_imagenet64.py | 2 +- axial/utils.py | 2 +- depth_from_video_in_the_wild/consistency_losses.py | 2 +- depth_from_video_in_the_wild/depth_prediction_net.py | 2 +- depth_from_video_in_the_wild/model.py | 2 +- protoattend/main_protoattend.py | 2 +- protoattend/model.py | 2 +- protoattend/options.py | 2 +- tabnet/data_helper_covertype.py | 2 +- tabnet/data_helper_poker.py | 2 +- tabnet/tabnet_model.py | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/axial/config_imagenet32.py b/axial/config_imagenet32.py index 23f1b372fcb5..3aefa9715332 100644 --- a/axial/config_imagenet32.py +++ b/axial/config_imagenet32.py @@ -17,7 +17,7 @@ from __future__ import division from __future__ import print_function -import tensorflow as tf +import tensorflow.compat.v1 as tf def get_config(): diff --git a/axial/config_imagenet64.py b/axial/config_imagenet64.py index 78c59f23e275..197ce4ee2170 100644 --- a/axial/config_imagenet64.py +++ b/axial/config_imagenet64.py @@ -17,7 +17,7 @@ from __future__ import division from __future__ import print_function -import tensorflow as tf +import tensorflow.compat.v1 as tf def get_config(): diff --git a/axial/utils.py b/axial/utils.py index 69c8fee547e9..4fde0e84281d 100644 --- a/axial/utils.py +++ b/axial/utils.py @@ -18,7 +18,7 @@ from __future__ import print_function import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow.python.tpu import tpu_function diff --git a/depth_from_video_in_the_wild/consistency_losses.py b/depth_from_video_in_the_wild/consistency_losses.py index d1cc746fdbca..3246aeaf0cc2 100644 --- a/depth_from_video_in_the_wild/consistency_losses.py +++ b/depth_from_video_in_the_wild/consistency_losses.py @@ -19,7 +19,7 @@ from __future__ import division from __future__ import print_function -import tensorflow as tf # tf +import tensorflow.compat.v1 as tf # tf from depth_from_video_in_the_wild import transform_utils from tensorflow.contrib import resampler as contrib_resampler diff --git a/depth_from_video_in_the_wild/depth_prediction_net.py b/depth_from_video_in_the_wild/depth_prediction_net.py index 9d8e978f33ef..bdaa1d387c5b 100644 --- a/depth_from_video_in_the_wild/depth_prediction_net.py +++ b/depth_from_video_in_the_wild/depth_prediction_net.py @@ -19,7 +19,7 @@ """ import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow.contrib import framework as contrib_framework from tensorflow.contrib import layers as contrib_layers diff --git a/depth_from_video_in_the_wild/model.py b/depth_from_video_in_the_wild/model.py index 3481f3e63525..72fa40424f4f 100644 --- a/depth_from_video_in_the_wild/model.py +++ b/depth_from_video_in_the_wild/model.py @@ -24,7 +24,7 @@ from absl import logging -import tensorflow as tf +import tensorflow.compat.v1 as tf from depth_from_video_in_the_wild import consistency_losses from depth_from_video_in_the_wild import depth_prediction_net from depth_from_video_in_the_wild import motion_prediction_net diff --git a/protoattend/main_protoattend.py b/protoattend/main_protoattend.py index d119cabd77bb..501d663a4986 100644 --- a/protoattend/main_protoattend.py +++ b/protoattend/main_protoattend.py @@ -27,7 +27,7 @@ import model import numpy as np from options import FLAGS -import tensorflow as tf +import tensorflow.compat.v1 as tf import utils # GPU options diff --git a/protoattend/model.py b/protoattend/model.py index a15abce0bcc7..0d9e261803a2 100644 --- a/protoattend/model.py +++ b/protoattend/model.py @@ -22,7 +22,7 @@ import input_data import numpy as np from options import FLAGS -import tensorflow as tf +import tensorflow.compat.v1 as tf # Building blocks of the network diff --git a/protoattend/options.py b/protoattend/options.py index b986b5be5b87..f412e46917ac 100644 --- a/protoattend/options.py +++ b/protoattend/options.py @@ -15,7 +15,7 @@ """Input flags.""" -import tensorflow as tf +import tensorflow.compat.v1 as tf flags = tf.app.flags FLAGS = flags.FLAGS diff --git a/tabnet/data_helper_covertype.py b/tabnet/data_helper_covertype.py index f07f3e66039c..38c7e3d0e8de 100644 --- a/tabnet/data_helper_covertype.py +++ b/tabnet/data_helper_covertype.py @@ -15,7 +15,7 @@ """Data helper function for the Forest Covertype dataset.""" -import tensorflow as tf +import tensorflow.compat.v1 as tf # Dataset size # N_TRAIN_SAMPLES = 309871 diff --git a/tabnet/data_helper_poker.py b/tabnet/data_helper_poker.py index 7ea1a4f336fe..317abd5327e2 100644 --- a/tabnet/data_helper_poker.py +++ b/tabnet/data_helper_poker.py @@ -15,7 +15,7 @@ """Data helper function for the Poker dataset.""" -import tensorflow as tf +import tensorflow.compat.v1 as tf # Dataset size # N_TRAIN_SAMPLES = 25010 diff --git a/tabnet/tabnet_model.py b/tabnet/tabnet_model.py index e751886f5e74..c2a8f9e2b82e 100644 --- a/tabnet/tabnet_model.py +++ b/tabnet/tabnet_model.py @@ -20,7 +20,7 @@ from __future__ import print_function import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf def glu(act, n_units):