(dataType DataType)
| 469 | } |
| 470 | |
| 471 | func isTensorSerializable(dataType DataType) error { |
| 472 | // For numeric types, the serialized Tensor matches the in-memory |
| 473 | // representation. See the implementation of Tensor::AsProtoContent in |
| 474 | // https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc |
| 475 | // |
| 476 | // The more appropriate way to be in sync with Tensor::AsProtoContent |
| 477 | // would be to have the TensorFlow C library export functions for |
| 478 | // serialization and deserialization of Tensors. Till then capitalize |
| 479 | // on knowledge of the implementation for numeric types. |
| 480 | switch dataType { |
| 481 | case Float, Double, Int32, Uint8, Int16, Int8, Complex, Int64, Bool, Quint8, Qint32, Bfloat16, Qint16, Quint16, Uint16, Complex128, Half: |
| 482 | return nil |
| 483 | default: |
| 484 | return fmt.Errorf("serialization of tensors with the DataType %d is not yet supported, see https://github.com/tensorflow/tensorflow/issues/6003", dataType) |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // nativeEndian is the byte order for the local platform. Used to send back and |
| 489 | // forth Tensors with the C API. We test for endianness at runtime because |
no outgoing calls
no test coverage detected