Fix Python 3 compatibility issues

PiperOrigin-RevId: 228232503
This commit is contained in:
schien 2019-01-07 14:07:45 -08:00 committed by schien1729
parent 555e8e293a
commit 251d6298c6
4 changed files with 20 additions and 0 deletions

View file

@ -46,6 +46,11 @@ import sys
import numpy as np
from scipy import special
try:
long
except NameError:
long = int
########################
# LOG-SPACE ARITHMETIC #
########################

View file

@ -24,6 +24,11 @@ import tensorflow as tf
from privacy.optimizers import dp_optimizer
try:
xrange
except NameError:
xrange = range
def loss(val0, val1):
"""Loss function that is minimized at the mean of the input points."""

View file

@ -24,6 +24,11 @@ import tensorflow as tf
from privacy.optimizers import gaussian_query
try:
xrange
except NameError:
xrange = range
def _run_query(query, records):
"""Executes query on the given set of records as a single sample.

View file

@ -30,6 +30,11 @@ nest = tf.contrib.framework.nest
_basic_query = gaussian_query.GaussianSumQuery(1.0, 0.0)
try:
xrange
except NameError:
xrange = range
def _run_query(query, records):
"""Executes query on the given set of records as a single sample.