From c08f3ebdc76d93679865888f93ca8b5224f70536 Mon Sep 17 00:00:00 2001 From: Zachary Garrett Date: Thu, 1 Aug 2019 16:32:08 -0700 Subject: [PATCH] Workaround until the new `bolt_on` module is integrated into the rest of the TF Privacy build system. PiperOrigin-RevId: 261222062 --- privacy/__init__.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/privacy/__init__.py b/privacy/__init__.py index aab6e94..f530a11 100644 --- a/privacy/__init__.py +++ b/privacy/__init__.py @@ -13,6 +13,10 @@ # limitations under the License. """TensorFlow Privacy library.""" +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + import sys # pylint: disable=g-import-not-at-top @@ -42,8 +46,11 @@ else: from privacy.optimizers.dp_optimizer import DPGradientDescentGaussianOptimizer from privacy.optimizers.dp_optimizer import DPGradientDescentOptimizer - from privacy.bolt_on.models import BoltOnModel - from privacy.bolt_on.optimizers import BoltOn - from privacy.bolt_on.losses import StrongConvexMixin - from privacy.bolt_on.losses import StrongConvexBinaryCrossentropy - from privacy.bolt_on.losses import StrongConvexHuber + try: + from privacy.bolt_on.models import BoltOnModel + from privacy.bolt_on.optimizers import BoltOn + from privacy.bolt_on.losses import StrongConvexMixin + from privacy.bolt_on.losses import StrongConvexBinaryCrossentropy + from privacy.bolt_on.losses import StrongConvexHuber + except ImportError: + print('module `bolt_on` was not found in this version of TF Privacy')