Explicitly replace "import tensorflow" with "tensorflow.compat.v1" for TF2.x migration

PiperOrigin-RevId: 297199727
This commit is contained in:
Yanhua Sun 2020-02-25 14:11:27 -08:00 committed by A. Unique TensorFlower
parent 5238ccd77b
commit b0df24ef25
8 changed files with 8 additions and 8 deletions

View file

@ -42,7 +42,7 @@ import os
import math import math
import numpy as np import numpy as np
from six.moves import xrange from six.moves import xrange
import tensorflow as tf import tensorflow.compat.v1 as tf
import maybe_download import maybe_download

View file

@ -21,7 +21,7 @@ from datetime import datetime
import math import math
import numpy as np import numpy as np
from six.moves import xrange from six.moves import xrange
import tensorflow as tf import tensorflow.compat.v1 as tf
import time import time
import utils import utils

View file

@ -28,7 +28,7 @@ from scipy.io import loadmat as loadmat
from six.moves import cPickle as pickle from six.moves import cPickle as pickle
from six.moves import urllib from six.moves import urllib
from six.moves import xrange from six.moves import xrange
import tensorflow as tf import tensorflow.compat.v1 as tf
FLAGS = tf.flags.FLAGS FLAGS = tf.flags.FLAGS

View file

@ -22,7 +22,7 @@ import input # pylint: disable=redefined-builtin
import metrics import metrics
import numpy as np import numpy as np
from six.moves import xrange from six.moves import xrange
import tensorflow as tf import tensorflow.compat.v1 as tf
FLAGS = tf.flags.FLAGS FLAGS = tf.flags.FLAGS

View file

@ -19,7 +19,7 @@ from __future__ import print_function
import deep_cnn import deep_cnn
import input # pylint: disable=redefined-builtin import input # pylint: disable=redefined-builtin
import metrics import metrics
import tensorflow as tf import tensorflow.compat.v1 as tf
tf.flags.DEFINE_string('dataset', 'svhn', 'The name of the dataset to use') tf.flags.DEFINE_string('dataset', 'svhn', 'The name of the dataset to use')

View file

@ -19,7 +19,7 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import tensorflow as tf import tensorflow.compat.v1 as tf
from tensorflow_privacy.privacy.dp_query import dp_query from tensorflow_privacy.privacy.dp_query import dp_query
import tree import tree

View file

@ -33,7 +33,7 @@ from absl import flags
from distutils.version import LooseVersion from distutils.version import LooseVersion
import numpy as np import numpy as np
import tensorflow as tf import tensorflow.compat.v1 as tf
from tensorflow_privacy.privacy.analysis.rdp_accountant import compute_rdp from tensorflow_privacy.privacy.analysis.rdp_accountant import compute_rdp
from tensorflow_privacy.privacy.analysis.rdp_accountant import get_privacy_spent from tensorflow_privacy.privacy.analysis.rdp_accountant import get_privacy_spent

View file

@ -19,7 +19,7 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np import numpy as np
import tensorflow as tf import tensorflow.compat.v1 as tf
tf.flags.DEFINE_float('learning_rate', .15, 'Learning rate for training') tf.flags.DEFINE_float('learning_rate', .15, 'Learning rate for training')
tf.flags.DEFINE_integer('batch_size', 256, 'Batch size') tf.flags.DEFINE_integer('batch_size', 256, 'Batch size')