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

Add float16 to _TENSOR_CONTENT_TYPES in tf.make_tensor_proto #38258

Merged
merged 2 commits into from
Apr 13, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions tensorflow/python/framework/tensor_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ def _FlattenToStrings(nested_strings):


_TENSOR_CONTENT_TYPES = frozenset([
dtypes.float32, dtypes.float64, dtypes.int32, dtypes.uint8, dtypes.int16,
dtypes.int8, dtypes.int64, dtypes.qint8, dtypes.quint8, dtypes.qint16,
dtypes.quint16, dtypes.qint32, dtypes.uint32, dtypes.uint64
dtypes.float16, dtypes.float32, dtypes.float64, dtypes.int32, dtypes.uint8,
ganler marked this conversation as resolved.
Show resolved Hide resolved
dtypes.int16, dtypes.int8, dtypes.int64, dtypes.qint8, dtypes.quint8,
dtypes.qint16, dtypes.quint16, dtypes.qint32, dtypes.uint32, dtypes.uint64
])


Expand Down
9 changes: 2 additions & 7 deletions tensorflow/python/framework/tensor_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,8 @@ def testHalf(self):
t = tensor_util.make_tensor_proto(np.array([10.0, 20.0], dtype=np.float16))
self.assertProtoEquals("""
dtype: DT_HALF
tensor_shape {
dim {
size: 2
}
}
half_val: 18688
half_val: 19712
tensor_shape { dim { size: 2 } }
tensor_content: "\000I\000M"
ganler marked this conversation as resolved.
Show resolved Hide resolved
""", t)

a = tensor_util.MakeNdarray(t)
Expand Down