Fix bfloat16 serialization of Tensors.
authorPeter Hawkins <phawkins@google.com>
Wed, 13 Dec 2017 23:21:11 +0000 (15:21 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 13 Dec 2017 23:25:12 +0000 (15:25 -0800)
commitd80d6de2890112f0013ffede31767907ec3291ca
tree2133473e0938b551c2ac79e683336952f660c4c7
parentb09be8eff9505486b0f838e2cb281c3ebe8ecfc6
Fix bfloat16 serialization of Tensors.

Previously, Python serialization and deserialization used the half_val field of TensorProto, whereas C++ serialization used the int_val field. However, C++ bfloat16 deserialization was always broken, so it was never possible to correctly deserialize a bfloat16 Tensor.

The only reason serialization worked at all was because of the generic tensor_contents bytes serialization.

PiperOrigin-RevId: 178966536
tensorflow/core/framework/tensor.cc
tensorflow/core/framework/tensor.proto
tensorflow/core/framework/tensor_test.cc
tensorflow/python/kernel_tests/constant_op_test.py