Skip to content

Commit

Permalink
Merge pull request tensorflow#3220 from cclauss/long-was-removed-in-p…
Browse files Browse the repository at this point in the history
…ython3

long was removed in Python 3 (en masse)
  • Loading branch information
nealwu authored Jan 23, 2018
2 parents 1d31378 + 7431515 commit eb7c6e4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion research/brain_coder/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from absl import logging
import numpy as np
import six
from six.moves import xrange
import tensorflow as tf

Expand Down Expand Up @@ -138,7 +139,7 @@ def stack_pad(tensors, pad_axes=None, pad_to_lengths=None, dtype=np.float32,
same_axes = dict(enumerate(max_lengths))
if pad_axes is None:
pad_axes = []
if isinstance(pad_axes, (int, long)):
if isinstance(pad_axes, six.integer_types):
if pad_to_lengths is not None:
max_lengths[pad_axes] = pad_to_lengths
del same_axes[pad_axes]
Expand Down
5 changes: 3 additions & 2 deletions research/compression/entropy_coder/lib/block_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import math

import numpy as np
import six
import tensorflow as tf


Expand All @@ -39,7 +40,7 @@ def __init__(self, dims=(0,), **kwargs):
1.0 / sqrt(product(shape[dims]))
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
"""
if isinstance(dims, (int, long)):
if isinstance(dims, six.integer_types):
self._dims = [dims]
else:
self._dims = dims
Expand Down Expand Up @@ -73,7 +74,7 @@ def __init__(self, dims=(0,), scale=2.0, **kwargs):
sqrt(scale / product(shape[dims])).
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
"""
if isinstance(dims, (int, long)):
if isinstance(dims, six.integer_types):
self._dims = [dims]
else:
self._dims = dims
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def main(_):
tf_example = oid_tfrecord_creation.tf_example_from_annotations_data_frame(
image_annotations, label_map, encoded_image)
if tf_example:
shard_idx = long(image_id, 16) % FLAGS.num_shards
shard_idx = int(image_id, 16) % FLAGS.num_shards
output_tfrecords[shard_idx].write(tf_example.SerializeToString())


Expand Down
4 changes: 2 additions & 2 deletions research/object_detection/utils/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ def padded_one_hot_encoding(indices, depth, left_pad):
TODO: add runtime checks for depth and indices.
"""
if depth < 0 or not isinstance(depth, (int, long) if six.PY2 else int):
if depth < 0 or not isinstance(depth, six.integer_types):
raise ValueError('`depth` must be a non-negative integer.')
if left_pad < 0 or not isinstance(left_pad, (int, long) if six.PY2 else int):
if left_pad < 0 or not isinstance(left_pad, six.integer_types):
raise ValueError('`left_pad` must be a non-negative integer.')
if depth == 0:
return None
Expand Down

0 comments on commit eb7c6e4

Please sign in to comment.