From 856eda3aa15e7bbec4bb9d8b4e5b4621aff23db2 Mon Sep 17 00:00:00 2001 From: Yanhua Sun Date: Fri, 17 Jan 2020 15:39:43 -0800 Subject: [PATCH] Explicitly replace "import tensorflow" with "tensorflow.compat.v1" PiperOrigin-RevId: 290355582 --- .../privacy/analysis/privacy_ledger.py | 2 +- .../privacy/analysis/privacy_ledger_test.py | 2 +- .../privacy/analysis/tensor_buffer.py | 2 +- .../analysis/tensor_buffer_test_eager.py | 2 +- .../analysis/tensor_buffer_test_graph.py | 2 +- .../privacy/bolt_on/__init__.py | 2 +- tensorflow_privacy/privacy/bolt_on/losses.py | 12 +++++------ .../privacy/bolt_on/losses_test.py | 8 ++++---- tensorflow_privacy/privacy/bolt_on/models.py | 8 ++++---- .../privacy/bolt_on/models_test.py | 12 +++++------ .../privacy/bolt_on/optimizers.py | 6 +++--- .../privacy/bolt_on/optimizers_test.py | 20 +++++++++---------- .../privacy/dp_query/dp_query.py | 2 +- .../privacy/dp_query/gaussian_query.py | 2 +- .../privacy/dp_query/gaussian_query_test.py | 2 +- .../privacy/dp_query/nested_query_test.py | 2 +- .../privacy/dp_query/no_privacy_query.py | 2 +- .../privacy/dp_query/no_privacy_query_test.py | 2 +- .../privacy/dp_query/normalized_query.py | 2 +- .../privacy/dp_query/normalized_query_test.py | 2 +- .../quantile_adaptive_clip_sum_query.py | 2 +- .../quantile_adaptive_clip_sum_query_test.py | 2 +- .../privacy/optimizers/dp_optimizer.py | 2 +- .../optimizers/dp_optimizer_eager_test.py | 2 +- .../privacy/optimizers/dp_optimizer_test.py | 2 +- .../optimizers/dp_optimizer_vectorized.py | 2 +- .../dp_optimizer_vectorized_test.py | 2 +- tutorials/bolton_tutorial.py | 2 +- tutorials/lm_dpsgd_tutorial.py | 2 +- tutorials/mnist_dpsgd_tutorial.py | 2 +- tutorials/mnist_dpsgd_tutorial_eager.py | 2 +- tutorials/mnist_dpsgd_tutorial_keras.py | 2 +- tutorials/mnist_dpsgd_tutorial_vectorized.py | 2 +- 33 files changed, 60 insertions(+), 60 deletions(-) diff --git a/tensorflow_privacy/privacy/analysis/privacy_ledger.py b/tensorflow_privacy/privacy/analysis/privacy_ledger.py index b22aa22..65feab0 100644 --- a/tensorflow_privacy/privacy/analysis/privacy_ledger.py +++ b/tensorflow_privacy/privacy/analysis/privacy_ledger.py @@ -20,7 +20,7 @@ from __future__ import print_function import collections import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.analysis import tensor_buffer from tensorflow_privacy.privacy.dp_query import dp_query diff --git a/tensorflow_privacy/privacy/analysis/privacy_ledger_test.py b/tensorflow_privacy/privacy/analysis/privacy_ledger_test.py index d4da22d..7165316 100644 --- a/tensorflow_privacy/privacy/analysis/privacy_ledger_test.py +++ b/tensorflow_privacy/privacy/analysis/privacy_ledger_test.py @@ -18,7 +18,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.analysis import privacy_ledger from tensorflow_privacy.privacy.dp_query import gaussian_query diff --git a/tensorflow_privacy/privacy/analysis/tensor_buffer.py b/tensorflow_privacy/privacy/analysis/tensor_buffer.py index 83a6b60..039be8b 100644 --- a/tensorflow_privacy/privacy/analysis/tensor_buffer.py +++ b/tensorflow_privacy/privacy/analysis/tensor_buffer.py @@ -17,7 +17,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 class TensorBuffer(object): diff --git a/tensorflow_privacy/privacy/analysis/tensor_buffer_test_eager.py b/tensorflow_privacy/privacy/analysis/tensor_buffer_test_eager.py index f09d697..fd22284 100644 --- a/tensorflow_privacy/privacy/analysis/tensor_buffer_test_eager.py +++ b/tensorflow_privacy/privacy/analysis/tensor_buffer_test_eager.py @@ -17,7 +17,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.analysis import tensor_buffer diff --git a/tensorflow_privacy/privacy/analysis/tensor_buffer_test_graph.py b/tensorflow_privacy/privacy/analysis/tensor_buffer_test_graph.py index 525f853..d2cd340 100644 --- a/tensorflow_privacy/privacy/analysis/tensor_buffer_test_graph.py +++ b/tensorflow_privacy/privacy/analysis/tensor_buffer_test_graph.py @@ -17,7 +17,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.analysis import tensor_buffer diff --git a/tensorflow_privacy/privacy/bolt_on/__init__.py b/tensorflow_privacy/privacy/bolt_on/__init__.py index 2f87e3c..2fed767 100644 --- a/tensorflow_privacy/privacy/bolt_on/__init__.py +++ b/tensorflow_privacy/privacy/bolt_on/__init__.py @@ -14,7 +14,7 @@ """BoltOn Method for privacy.""" import sys from distutils.version import LooseVersion -import tensorflow as tf +import tensorflow.compat.v1 as tf if LooseVersion(tf.__version__) < LooseVersion("2.0.0"): raise ImportError("Please upgrade your version " diff --git a/tensorflow_privacy/privacy/bolt_on/losses.py b/tensorflow_privacy/privacy/bolt_on/losses.py index 81bd0c3..ea18ae0 100644 --- a/tensorflow_privacy/privacy/bolt_on/losses.py +++ b/tensorflow_privacy/privacy/bolt_on/losses.py @@ -17,12 +17,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf -from tensorflow.python.framework import ops as _ops -from tensorflow.python.keras import losses -from tensorflow.python.keras.regularizers import L1L2 -from tensorflow.python.keras.utils import losses_utils -from tensorflow.python.platform import tf_logging as logging +import tensorflow.compat.v1 as tf +from tensorflow.compat.v1.python.framework import ops as _ops +from tensorflow.compat.v1.python.keras import losses +from tensorflow.compat.v1.python.keras.regularizers import L1L2 +from tensorflow.compat.v1.python.keras.utils import losses_utils +from tensorflow.compat.v1.python.platform import tf_logging as logging class StrongConvexMixin: # pylint: disable=old-style-class diff --git a/tensorflow_privacy/privacy/bolt_on/losses_test.py b/tensorflow_privacy/privacy/bolt_on/losses_test.py index 67f3d9c..57effb8 100644 --- a/tensorflow_privacy/privacy/bolt_on/losses_test.py +++ b/tensorflow_privacy/privacy/bolt_on/losses_test.py @@ -21,10 +21,10 @@ from contextlib import contextmanager # pylint: disable=g-importing-member from io import StringIO # pylint: disable=g-importing-member import sys from absl.testing import parameterized -import tensorflow as tf -from tensorflow.python.framework import test_util -from tensorflow.python.keras import keras_parameterized -from tensorflow.python.keras.regularizers import L1L2 +import tensorflow.compat.v1 as tf +from tensorflow.compat.v1.python.framework import test_util +from tensorflow.compat.v1.python.keras import keras_parameterized +from tensorflow.compat.v1.python.keras.regularizers import L1L2 from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexBinaryCrossentropy from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexHuber from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexMixin diff --git a/tensorflow_privacy/privacy/bolt_on/models.py b/tensorflow_privacy/privacy/bolt_on/models.py index efea5cd..7a3df40 100644 --- a/tensorflow_privacy/privacy/bolt_on/models.py +++ b/tensorflow_privacy/privacy/bolt_on/models.py @@ -16,10 +16,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf -from tensorflow.python.framework import ops as _ops -from tensorflow.python.keras import optimizers -from tensorflow.python.keras.models import Model +import tensorflow.compat.v1 as tf +from tensorflow.compat.v1.python.framework import ops as _ops +from tensorflow.compat.v1.python.keras import optimizers +from tensorflow.compat.v1.python.keras.models import Model from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexMixin from tensorflow_privacy.privacy.bolt_on.optimizers import BoltOn diff --git a/tensorflow_privacy/privacy/bolt_on/models_test.py b/tensorflow_privacy/privacy/bolt_on/models_test.py index a47e8b4..49ec663 100644 --- a/tensorflow_privacy/privacy/bolt_on/models_test.py +++ b/tensorflow_privacy/privacy/bolt_on/models_test.py @@ -18,12 +18,12 @@ from __future__ import division from __future__ import print_function from absl.testing import parameterized -import tensorflow as tf -from tensorflow.python.framework import ops as _ops -from tensorflow.python.keras import keras_parameterized -from tensorflow.python.keras import losses -from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2 -from tensorflow.python.keras.regularizers import L1L2 +import tensorflow.compat.v1 as tf +from tensorflow.compat.v1.python.framework import ops as _ops +from tensorflow.compat.v1.python.keras import keras_parameterized +from tensorflow.compat.v1.python.keras import losses +from tensorflow.compat.v1.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2 +from tensorflow.compat.v1.python.keras.regularizers import L1L2 from tensorflow_privacy.privacy.bolt_on import models from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexMixin from tensorflow_privacy.privacy.bolt_on.optimizers import BoltOn diff --git a/tensorflow_privacy/privacy/bolt_on/optimizers.py b/tensorflow_privacy/privacy/bolt_on/optimizers.py index eac6641..6c45026 100644 --- a/tensorflow_privacy/privacy/bolt_on/optimizers.py +++ b/tensorflow_privacy/privacy/bolt_on/optimizers.py @@ -17,9 +17,9 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf -from tensorflow.python.keras.optimizer_v2 import optimizer_v2 -from tensorflow.python.ops import math_ops +import tensorflow.compat.v1 as tf +from tensorflow.compat.v1.python.keras.optimizer_v2 import optimizer_v2 +from tensorflow.compat.v1.python.ops import math_ops from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexMixin _accepted_distributions = ['laplace'] # implemented distributions for noising diff --git a/tensorflow_privacy/privacy/bolt_on/optimizers_test.py b/tensorflow_privacy/privacy/bolt_on/optimizers_test.py index 8ea4fa9..01341a7 100644 --- a/tensorflow_privacy/privacy/bolt_on/optimizers_test.py +++ b/tensorflow_privacy/privacy/bolt_on/optimizers_test.py @@ -19,16 +19,16 @@ from __future__ import print_function import unittest from absl.testing import parameterized -import tensorflow as tf -from tensorflow.python import ops as _ops -from tensorflow.python.framework import test_util -from tensorflow.python.keras import keras_parameterized -from tensorflow.python.keras import losses -from tensorflow.python.keras.initializers import constant -from tensorflow.python.keras.models import Model -from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2 -from tensorflow.python.keras.regularizers import L1L2 -from tensorflow.python.platform import test +import tensorflow.compat.v1 as tf +from tensorflow.compat.v1.python import ops as _ops +from tensorflow.compat.v1.python.framework import test_util +from tensorflow.compat.v1.python.keras import keras_parameterized +from tensorflow.compat.v1.python.keras import losses +from tensorflow.compat.v1.python.keras.initializers import constant +from tensorflow.compat.v1.python.keras.models import Model +from tensorflow.compat.v1.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2 +from tensorflow.compat.v1.python.keras.regularizers import L1L2 +from tensorflow.compat.v1.python.platform import test from tensorflow_privacy.privacy.bolt_on import optimizers as opt from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexMixin diff --git a/tensorflow_privacy/privacy/dp_query/dp_query.py b/tensorflow_privacy/privacy/dp_query/dp_query.py index 5ee3c51..15dcd56 100644 --- a/tensorflow_privacy/privacy/dp_query/dp_query.py +++ b/tensorflow_privacy/privacy/dp_query/dp_query.py @@ -48,7 +48,7 @@ from __future__ import print_function import abc -import tensorflow as tf +import tensorflow.compat.v1 as tf class DPQuery(object): diff --git a/tensorflow_privacy/privacy/dp_query/gaussian_query.py b/tensorflow_privacy/privacy/dp_query/gaussian_query.py index 38bfae8..c119490 100644 --- a/tensorflow_privacy/privacy/dp_query/gaussian_query.py +++ b/tensorflow_privacy/privacy/dp_query/gaussian_query.py @@ -22,7 +22,7 @@ from __future__ import print_function import collections from distutils.version import LooseVersion -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 normalized_query diff --git a/tensorflow_privacy/privacy/dp_query/gaussian_query_test.py b/tensorflow_privacy/privacy/dp_query/gaussian_query_test.py index 8e6efb9..d330946 100644 --- a/tensorflow_privacy/privacy/dp_query/gaussian_query_test.py +++ b/tensorflow_privacy/privacy/dp_query/gaussian_query_test.py @@ -21,7 +21,7 @@ from __future__ import print_function from absl.testing import parameterized import numpy as np from six.moves import xrange -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.dp_query import gaussian_query from tensorflow_privacy.privacy.dp_query import test_utils diff --git a/tensorflow_privacy/privacy/dp_query/nested_query_test.py b/tensorflow_privacy/privacy/dp_query/nested_query_test.py index 509468f..06749b1 100644 --- a/tensorflow_privacy/privacy/dp_query/nested_query_test.py +++ b/tensorflow_privacy/privacy/dp_query/nested_query_test.py @@ -21,7 +21,7 @@ from __future__ import print_function from absl.testing import parameterized import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.dp_query import gaussian_query from tensorflow_privacy.privacy.dp_query import nested_query diff --git a/tensorflow_privacy/privacy/dp_query/no_privacy_query.py b/tensorflow_privacy/privacy/dp_query/no_privacy_query.py index a6f0c10..312fe34 100644 --- a/tensorflow_privacy/privacy/dp_query/no_privacy_query.py +++ b/tensorflow_privacy/privacy/dp_query/no_privacy_query.py @@ -17,7 +17,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 diff --git a/tensorflow_privacy/privacy/dp_query/no_privacy_query_test.py b/tensorflow_privacy/privacy/dp_query/no_privacy_query_test.py index f38eaaa..64595b7 100644 --- a/tensorflow_privacy/privacy/dp_query/no_privacy_query_test.py +++ b/tensorflow_privacy/privacy/dp_query/no_privacy_query_test.py @@ -19,7 +19,7 @@ from __future__ import division from __future__ import print_function from absl.testing import parameterized -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.dp_query import no_privacy_query from tensorflow_privacy.privacy.dp_query import test_utils diff --git a/tensorflow_privacy/privacy/dp_query/normalized_query.py b/tensorflow_privacy/privacy/dp_query/normalized_query.py index 75f8946..f09a113 100644 --- a/tensorflow_privacy/privacy/dp_query/normalized_query.py +++ b/tensorflow_privacy/privacy/dp_query/normalized_query.py @@ -21,7 +21,7 @@ from __future__ import print_function import collections -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.dp_query import dp_query diff --git a/tensorflow_privacy/privacy/dp_query/normalized_query_test.py b/tensorflow_privacy/privacy/dp_query/normalized_query_test.py index 838a89b..ec66b35 100644 --- a/tensorflow_privacy/privacy/dp_query/normalized_query_test.py +++ b/tensorflow_privacy/privacy/dp_query/normalized_query_test.py @@ -18,7 +18,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 gaussian_query from tensorflow_privacy.privacy.dp_query import normalized_query diff --git a/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_sum_query.py b/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_sum_query.py index af51f56..31edb1f 100644 --- a/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_sum_query.py +++ b/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_sum_query.py @@ -27,7 +27,7 @@ from __future__ import print_function import collections -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 gaussian_query diff --git a/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_sum_query_test.py b/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_sum_query_test.py index 8bdbc94..67d4041 100644 --- a/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_sum_query_test.py +++ b/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_sum_query_test.py @@ -21,7 +21,7 @@ from __future__ import print_function from absl.testing import parameterized import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.analysis import privacy_ledger from tensorflow_privacy.privacy.dp_query import quantile_adaptive_clip_sum_query diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer.py index 5bd0be8..62641b4 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer.py @@ -19,7 +19,7 @@ from __future__ import print_function from absl import logging -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.analysis import privacy_ledger from tensorflow_privacy.privacy.dp_query import gaussian_query diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_eager_test.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_eager_test.py index bbc2718..e993842 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_eager_test.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_eager_test.py @@ -19,7 +19,7 @@ from __future__ import print_function from absl.testing import parameterized import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.analysis import privacy_ledger from tensorflow_privacy.privacy.dp_query import gaussian_query diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py index 421fff0..0153cc5 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py @@ -20,7 +20,7 @@ from __future__ import print_function from absl.testing import parameterized import mock import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.analysis import privacy_ledger from tensorflow_privacy.privacy.dp_query import gaussian_query diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized.py index baac620..2d3f7fd 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized.py @@ -19,7 +19,7 @@ from __future__ import print_function from absl import logging -import tensorflow as tf +import tensorflow.compat.v1 as tf AdagradOptimizer = tf.compat.v1.train.AdagradOptimizer AdamOptimizer = tf.compat.v1.train.AdamOptimizer diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized_test.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized_test.py index b3bacdf..83aaf48 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized_test.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized_test.py @@ -20,7 +20,7 @@ from __future__ import print_function from absl.testing import parameterized import mock import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.optimizers import dp_optimizer_vectorized from tensorflow_privacy.privacy.optimizers.dp_optimizer_vectorized import VectorizedDPAdagrad diff --git a/tutorials/bolton_tutorial.py b/tutorials/bolton_tutorial.py index 55c8682..374a39c 100644 --- a/tutorials/bolton_tutorial.py +++ b/tutorials/bolton_tutorial.py @@ -15,7 +15,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf # pylint: disable=wrong-import-position +import tensorflow.compat.v1 as tf # pylint: disable=wrong-import-position from tensorflow_privacy.privacy.bolt_on import losses # pylint: disable=wrong-import-position from tensorflow_privacy.privacy.bolt_on import models # pylint: disable=wrong-import-position from tensorflow_privacy.privacy.bolt_on.optimizers import BoltOn # pylint: disable=wrong-import-position diff --git a/tutorials/lm_dpsgd_tutorial.py b/tutorials/lm_dpsgd_tutorial.py index d41dda3..93a8971 100644 --- a/tutorials/lm_dpsgd_tutorial.py +++ b/tutorials/lm_dpsgd_tutorial.py @@ -41,7 +41,7 @@ from absl import app from absl import flags import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf import tensorflow_datasets as tfds from tensorflow_privacy.privacy.analysis import privacy_ledger diff --git a/tutorials/mnist_dpsgd_tutorial.py b/tutorials/mnist_dpsgd_tutorial.py index 3dc990d..7b96434 100644 --- a/tutorials/mnist_dpsgd_tutorial.py +++ b/tutorials/mnist_dpsgd_tutorial.py @@ -22,7 +22,7 @@ from absl import app from absl import flags import numpy as np -import tensorflow as tf +import tensorflow.compat.v1 as tf from tensorflow_privacy.privacy.analysis import privacy_ledger from tensorflow_privacy.privacy.analysis.rdp_accountant import compute_rdp_from_ledger diff --git a/tutorials/mnist_dpsgd_tutorial_eager.py b/tutorials/mnist_dpsgd_tutorial_eager.py index 64ba951..7857731 100644 --- a/tutorials/mnist_dpsgd_tutorial_eager.py +++ b/tutorials/mnist_dpsgd_tutorial_eager.py @@ -20,7 +20,7 @@ from absl import app from absl import flags 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/mnist_dpsgd_tutorial_keras.py b/tutorials/mnist_dpsgd_tutorial_keras.py index eae9846..8726017 100644 --- a/tutorials/mnist_dpsgd_tutorial_keras.py +++ b/tutorials/mnist_dpsgd_tutorial_keras.py @@ -22,7 +22,7 @@ from absl import flags from absl import logging 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/mnist_dpsgd_tutorial_vectorized.py b/tutorials/mnist_dpsgd_tutorial_vectorized.py index 66cf98f..8c1347f 100644 --- a/tutorials/mnist_dpsgd_tutorial_vectorized.py +++ b/tutorials/mnist_dpsgd_tutorial_vectorized.py @@ -22,7 +22,7 @@ from absl import app from absl import flags 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