Commit graph

8 commits

Author SHA1 Message Date
Peter Hawkins
3d038a490a [NumPy] Remove references to deprecated NumPy type aliases.
This change replaces references to a number of deprecated NumPy type aliases (np.bool, np.int, np.float, np.complex, np.object, np.str) with their recommended replacement (bool, int, float, complex, object, str).

NumPy 1.24 drops the deprecated aliases, so we must remove uses before updating NumPy.

PiperOrigin-RevId: 497194550
2022-12-22 10:32:59 -08:00
Peter Hawkins
857fe8f482 [NumPy] Replace numpy.asscalar(x) with x.item() in preparation for upgrading NumPy to 1.23.
NumPy 1.23 removes numpy.asscalar() (https://numpy.org/doc/stable/release/1.23.0-notes.html#expired-deprecations), which has been deprecated since NumPy 1.16 (https://numpy.org/doc/stable/release/1.16.0-notes.html#new-deprecations).

x.item() should be identical to the previous implementation of numpy.asscalar(x) in every way.

PiperOrigin-RevId: 466743223
2022-08-10 11:27:07 -07:00
Michael Reneer
69d84d1892 Add TensorFlow Privacy BUILD and WORKSPACE files.
PiperOrigin-RevId: 429141704
2022-02-16 23:30:06 +00:00
Nicolas Papernot
be815437a6
reorder imports 2019-03-08 09:47:15 -08:00
cclauss
1fc7128da0
from six.moves import xrange
__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
2019-03-08 10:33:26 +01:00
badbayesian
e86cf16986 FIX: python3 compatibility 2019-01-15 14:54:28 -06:00
badbayesian
4c9971d4a8 FIX: python3 compatibility 2019-01-15 14:52:53 -06:00
Nicolas Papernot
93e9585f18 Add missing licenses.
PiperOrigin-RevId: 229241117
2019-01-14 16:02:35 -08:00