From b0df24ef25ba98eb1b72fd81f21e48e8811b1e07 Mon Sep 17 00:00:00 2001 From: Yanhua Sun Date: Tue, 25 Feb 2020 14:11:27 -0800 Subject: [PATCH] Explicitly replace "import tensorflow" with "tensorflow.compat.v1" for TF2.x migration PiperOrigin-RevId: 297199727 --- research/pate_2017/analysis.py | 2 +- research/pate_2017/deep_cnn.py | 2 +- research/pate_2017/input.py | 2 +- research/pate_2017/train_student.py | 2 +- research/pate_2017/train_teachers.py | 2 +- tensorflow_privacy/privacy/dp_query/nested_query.py | 2 +- tutorials/mnist_lr_tutorial.py | 2 +- tutorials/walkthrough/mnist_scratch.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/research/pate_2017/analysis.py b/research/pate_2017/analysis.py index 111a68c..cad4896 100644 --- a/research/pate_2017/analysis.py +++ b/research/pate_2017/analysis.py @@ -42,7 +42,7 @@ import os import math import numpy as np from six.moves import xrange -import tensorflow as tf +import tensorflow.compat.v1 as tf import maybe_download diff --git a/research/pate_2017/deep_cnn.py b/research/pate_2017/deep_cnn.py index 8bd9442..78a80a7 100644 --- a/research/pate_2017/deep_cnn.py +++ b/research/pate_2017/deep_cnn.py @@ -21,7 +21,7 @@ from datetime import datetime import math import numpy as np from six.moves import xrange -import tensorflow as tf +import tensorflow.compat.v1 as tf import time import utils diff --git a/research/pate_2017/input.py b/research/pate_2017/input.py index 4316b62..5553d26 100644 --- a/research/pate_2017/input.py +++ b/research/pate_2017/input.py @@ -28,7 +28,7 @@ from scipy.io import loadmat as loadmat from six.moves import cPickle as pickle from six.moves import urllib from six.moves import xrange -import tensorflow as tf +import tensorflow.compat.v1 as tf FLAGS = tf.flags.FLAGS diff --git a/research/pate_2017/train_student.py b/research/pate_2017/train_student.py index ab8330d..de61476 100644 --- a/research/pate_2017/train_student.py +++ b/research/pate_2017/train_student.py @@ -22,7 +22,7 @@ import input # pylint: disable=redefined-builtin import metrics import numpy as np from six.moves import xrange -import tensorflow as tf +import tensorflow.compat.v1 as tf FLAGS = tf.flags.FLAGS diff --git a/research/pate_2017/train_teachers.py b/research/pate_2017/train_teachers.py index c6ca5d2..0f8773b 100644 --- a/research/pate_2017/train_teachers.py +++ b/research/pate_2017/train_teachers.py @@ -19,7 +19,7 @@ from __future__ import print_function import deep_cnn import input # pylint: disable=redefined-builtin 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') diff --git a/tensorflow_privacy/privacy/dp_query/nested_query.py b/tensorflow_privacy/privacy/dp_query/nested_query.py index 5d0dbf8..dfdb6e8 100644 --- a/tensorflow_privacy/privacy/dp_query/nested_query.py +++ b/tensorflow_privacy/privacy/dp_query/nested_query.py @@ -19,7 +19,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.dp_query import dp_query import tree diff --git a/tutorials/mnist_lr_tutorial.py b/tutorials/mnist_lr_tutorial.py index c8bbf04..f16270f 100644 --- a/tutorials/mnist_lr_tutorial.py +++ b/tutorials/mnist_lr_tutorial.py @@ -33,7 +33,7 @@ from absl import flags from distutils.version import LooseVersion 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 get_privacy_spent diff --git a/tutorials/walkthrough/mnist_scratch.py b/tutorials/walkthrough/mnist_scratch.py index aa74ea6..9399e60 100644 --- a/tutorials/walkthrough/mnist_scratch.py +++ b/tutorials/walkthrough/mnist_scratch.py @@ -19,7 +19,7 @@ from __future__ import division from __future__ import print_function 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_integer('batch_size', 256, 'Batch size')