Fix Python 3 compatibility issues
This commit is contained in:
parent
183d751c13
commit
d72378f913
4 changed files with 20 additions and 0 deletions
|
@ -46,6 +46,11 @@ import sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy import special
|
from scipy import special
|
||||||
|
|
||||||
|
try:
|
||||||
|
long
|
||||||
|
except NameError:
|
||||||
|
long = int
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# LOG-SPACE ARITHMETIC #
|
# LOG-SPACE ARITHMETIC #
|
||||||
########################
|
########################
|
||||||
|
|
|
@ -24,6 +24,11 @@ import tensorflow as tf
|
||||||
|
|
||||||
from privacy.optimizers import dp_optimizer
|
from privacy.optimizers import dp_optimizer
|
||||||
|
|
||||||
|
try:
|
||||||
|
xrange
|
||||||
|
except NameError:
|
||||||
|
xrange = range
|
||||||
|
|
||||||
|
|
||||||
def loss(val0, val1):
|
def loss(val0, val1):
|
||||||
"""Loss function that is minimized at the mean of the input points."""
|
"""Loss function that is minimized at the mean of the input points."""
|
||||||
|
|
|
@ -24,6 +24,11 @@ import tensorflow as tf
|
||||||
|
|
||||||
from privacy.optimizers import gaussian_query
|
from privacy.optimizers import gaussian_query
|
||||||
|
|
||||||
|
try:
|
||||||
|
xrange
|
||||||
|
except NameError:
|
||||||
|
xrange = range
|
||||||
|
|
||||||
|
|
||||||
def _run_query(query, records):
|
def _run_query(query, records):
|
||||||
"""Executes query on the given set of records as a single sample.
|
"""Executes query on the given set of records as a single sample.
|
||||||
|
|
|
@ -30,6 +30,11 @@ nest = tf.contrib.framework.nest
|
||||||
|
|
||||||
_basic_query = gaussian_query.GaussianSumQuery(1.0, 0.0)
|
_basic_query = gaussian_query.GaussianSumQuery(1.0, 0.0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
xrange
|
||||||
|
except NameError:
|
||||||
|
xrange = range
|
||||||
|
|
||||||
|
|
||||||
def _run_query(query, records):
|
def _run_query(query, records):
|
||||||
"""Executes query on the given set of records as a single sample.
|
"""Executes query on the given set of records as a single sample.
|
||||||
|
|
Loading…
Reference in a new issue