The global state for DP query is intended for aspects of the query that change across samples under the query's own control. It was therefore unnecessary to wrap "l2_norm_clip" and "sum_stddev" in the namedtuple _GlobalState for the basic GaussianQuery classes.
PiperOrigin-RevId: 237528962
__xrange()__ was removed in Python 3 in favor of a reworked version of __range()__.
[flake8](http://flake8.pycqa.org) testing of https://github.com/tensorflow/privacy on Python 3.7.1
$ __flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics__
```
./privacy/optimizers/gaussian_query_test.py:65:16: F821 undefined name 'xrange'
for _ in xrange(1000):
^
./research/pate_2018/ICLR2018/rdp_bucketized.py:79:12: F821 undefined name 'xrange'
for i in xrange(n):
^
./research/pate_2018/ICLR2018/rdp_bucketized.py:106:12: F821 undefined name 'xrange'
for i in xrange(n):
^
./research/pate_2018/ICLR2018/rdp_bucketized.py:139:12: F821 undefined name 'xrange'
for i in xrange(n):
^
4 F821 undefined name 'xrange'
4
```
__E901,E999,F821,F822,F823__ are the "_showstopper_" [flake8](http://flake8.pycqa.org) issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
__xrange()__ was removed in Python 3 in favor of a reworked version of __range()__.
[flake8](http://flake8.pycqa.org) testing of https://github.com/tensorflow/privacy on Python 3.7.1
$ __flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics__
```
./privacy/optimizers/gaussian_query_test.py:65:16: F821 undefined name 'xrange'
for _ in xrange(1000):
^
./research/pate_2018/ICLR2018/rdp_bucketized.py:79:12: F821 undefined name 'xrange'
for i in xrange(n):
^
./research/pate_2018/ICLR2018/rdp_bucketized.py:106:12: F821 undefined name 'xrange'
for i in xrange(n):
^
./research/pate_2018/ICLR2018/rdp_bucketized.py:139:12: F821 undefined name 'xrange'
for i in xrange(n):
^
4 F821 undefined name 'xrange'
4
```
__E901,E999,F821,F822,F823__ are the "_showstopper_" [flake8](http://flake8.pycqa.org) issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
tf.nest.map_structure_up_to has changed so that map_structure_up_to(x, func, x, y) no longer raises an error when y is longer than x, for example x=[1,2], y=[1,2,3]. This broke one of our tests for nested query. Remove the test until (if and when) the old, more reasonable, behavior is restored.
PiperOrigin-RevId: 232057385
1. Rename PrivateQuery to DPQuery.
2. Move construction of DPQuery to outside of optimizer.
3. Remove PrivateAverageQuery and PrivateSumQuery, and rename DPQuery's 'get_query_result' method to 'get_noised_result'. Rename private_queries.py to dp_query.py.
4. Remove thrice-replicated run_query function from the test classes and replace with a single function in new test_utils.py.
5. Add functions gaussian_sum_query_from_noise_multplier and gaussian_average_query_from_noise_multplier.
PiperOrigin-RevId: 230595991