PiperOrigin-RevId: 239030654
This commit is contained in:
Nicolas Papernot 2019-03-18 11:51:21 -07:00 committed by A. Unique TensorFlower
parent 8fc35f9ca3
commit a9840529c4
5 changed files with 25 additions and 6 deletions

View file

@ -21,12 +21,16 @@ from __future__ import print_function
import collections import collections
from distutils.version import LooseVersion
import tensorflow as tf import tensorflow as tf
from privacy.analysis import tensor_buffer from privacy.analysis import tensor_buffer
from privacy.optimizers import dp_query from privacy.optimizers import dp_query
nest = tf.contrib.framework.nest if LooseVersion(tf.__version__) < LooseVersion('2.0.0'):
nest = tf.contrib.framework.nest
else:
nest = tf.nest
SampleEntry = collections.namedtuple( # pylint: disable=invalid-name SampleEntry = collections.namedtuple( # pylint: disable=invalid-name
'SampleEntry', ['population_size', 'selection_probability', 'queries']) 'SampleEntry', ['population_size', 'selection_probability', 'queries'])

View file

@ -19,11 +19,15 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
from distutils.version import LooseVersion
import tensorflow as tf import tensorflow as tf
from privacy.optimizers import dp_query from privacy.optimizers import dp_query
nest = tf.contrib.framework.nest if LooseVersion(tf.__version__) < LooseVersion('2.0.0'):
nest = tf.contrib.framework.nest
else:
nest = tf.nest
class GaussianSumQuery(dp_query.DPQuery): class GaussianSumQuery(dp_query.DPQuery):

View file

@ -19,12 +19,15 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
from distutils.version import LooseVersion
import tensorflow as tf import tensorflow as tf
from privacy.optimizers import dp_query from privacy.optimizers import dp_query
nest = tf.contrib.framework.nest if LooseVersion(tf.__version__) < LooseVersion('2.0.0'):
nest = tf.contrib.framework.nest
else:
nest = tf.nest
class NestedQuery(dp_query.DPQuery): class NestedQuery(dp_query.DPQuery):

View file

@ -20,6 +20,7 @@ from __future__ import print_function
from absl.testing import parameterized from absl.testing import parameterized
from distutils.version import LooseVersion
import numpy as np import numpy as np
import tensorflow as tf import tensorflow as tf
@ -27,7 +28,10 @@ from privacy.optimizers import gaussian_query
from privacy.optimizers import nested_query from privacy.optimizers import nested_query
from privacy.optimizers import test_utils from privacy.optimizers import test_utils
nest = tf.contrib.framework.nest if LooseVersion(tf.__version__) < LooseVersion('2.0.0'):
nest = tf.contrib.framework.nest
else:
nest = tf.nest
_basic_query = gaussian_query.GaussianSumQuery(1.0, 0.0) _basic_query = gaussian_query.GaussianSumQuery(1.0, 0.0)

View file

@ -17,11 +17,15 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
from distutils.version import LooseVersion
import tensorflow as tf import tensorflow as tf
from privacy.optimizers import dp_query from privacy.optimizers import dp_query
nest = tf.contrib.framework.nest if LooseVersion(tf.__version__) < LooseVersion('2.0.0'):
nest = tf.contrib.framework.nest
else:
nest = tf.nest
class NoPrivacySumQuery(dp_query.DPQuery): class NoPrivacySumQuery(dp_query.DPQuery):