Skip to content

Commit

Permalink
Fix long type not found for json input in python3 (#2269)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolga-b authored and jameswex committed May 23, 2019
1 parent 555236a commit b3546cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import tensorflow as tf
from google.protobuf import json_format
from six import iteritems
from six import string_types
from six import string_types, integer_types
from six.moves import zip # pylint: disable=redefined-builtin

from tensorboard.plugins.interactive_inference.utils import common_utils
Expand Down Expand Up @@ -155,7 +155,7 @@ def __init__(self, original_feature, index, mutant_value):
'unexpected type: {}'.format(type(original_feature)))
self.original_feature = original_feature

if index is not None and not isinstance(index, int):
if index is not None and not isinstance(index, integer_types):
raise ValueError(
'index should be None or int, but had unexpected type: {}'.format(
type(index)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys
import tensorflow as tf
from numbers import Number
from six import integer_types


def _is_colab():
Expand Down Expand Up @@ -488,7 +489,7 @@ def _convert_json_to_tf_examples(self, examples):
return tf_examples

def _add_single_feature(self, feat, value, ex):
if isinstance(value, (int, long)):
if isinstance(value, integer_types):
ex.features.feature[feat].int64_list.value.append(value)
elif isinstance(value, Number):
ex.features.feature[feat].float_list.value.append(value)
Expand Down

0 comments on commit b3546cc

Please sign in to comment.