Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix long type not found for json input in python3 #2269

Merged
merged 2 commits into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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