diff options
author | Henning Baldersheim <balder@oath.com> | 2019-04-05 11:13:53 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2019-04-05 11:26:30 +0000 |
commit | f46d5619c6dbac79bdb72924291ff2879ef7224a (patch) | |
tree | b5656a26766bff3a2b999b3e1a44971ccd9ecb27 /eval | |
parent | 747114c0f7835bf9a3e47a19e924856227efde8d (diff) |
Use bit number 3 mean 'with cell type' to carry forward the current schema where the bits hav meaning.
Update expected result.
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp | 2 | ||||
-rw-r--r-- | eval/src/vespa/eval/tensor/serialization/typed_binary_format.cpp | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp b/eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp index b4e0db4fa8f..b7aa988775d 100644 --- a/eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp +++ b/eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp @@ -265,7 +265,7 @@ TEST_F("test tensor serialization for DenseTensor", DenseFixture) { } TEST_F("test 'float' cells", DenseFixture) { - TEST_DO(f.assertSerialized({0x04, 0x01, 0x02, 0x01, 0x78, 0x03, + TEST_DO(f.assertSerialized({0x06, 0x01, 0x02, 0x01, 0x78, 0x03, 0x01, 0x79, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/eval/src/vespa/eval/tensor/serialization/typed_binary_format.cpp b/eval/src/vespa/eval/tensor/serialization/typed_binary_format.cpp index 813763ba268..4ca037e82a4 100644 --- a/eval/src/vespa/eval/tensor/serialization/typed_binary_format.cpp +++ b/eval/src/vespa/eval/tensor/serialization/typed_binary_format.cpp @@ -25,7 +25,9 @@ namespace { constexpr uint32_t SPARSE_BINARY_FORMAT_TYPE = 1u; constexpr uint32_t DENSE_BINARY_FORMAT_TYPE = 2u; constexpr uint32_t MIXED_BINARY_FORMAT_TYPE = 3u; -constexpr uint32_t TYPED_DENSE_BINARY_FORMAT_TYPE = 4u; +constexpr uint32_t SPARSE_BINARY_FORMAT_WITH_CELLTYPE = 5u; //Future +constexpr uint32_t DENSE_BINARY_FORMAT_WITH_CELLTYPE = 6u; +constexpr uint32_t MIXED_BINARY_FORMAT_WITH_CELLTYPE = 7u; //Future constexpr uint32_t DOUBLE_VALUE_TYPE = 0; constexpr uint32_t FLOAT_VALUE_TYPE = 1; @@ -60,7 +62,7 @@ TypedBinaryFormat::serialize(nbostream &stream, const Tensor &tensor, SerializeF { if (auto denseTensor = dynamic_cast<const DenseTensorView *>(&tensor)) { if (format != SerializeFormat::DOUBLE) { - stream.putInt1_4Bytes(TYPED_DENSE_BINARY_FORMAT_TYPE); + stream.putInt1_4Bytes(DENSE_BINARY_FORMAT_WITH_CELLTYPE); stream.putInt1_4Bytes(format2Encoding(format)); DenseBinaryFormat(format).serialize(stream, *denseTensor); } else { @@ -89,7 +91,7 @@ TypedBinaryFormat::deserialize(nbostream &stream) if (formatId == DENSE_BINARY_FORMAT_TYPE) { return DenseBinaryFormat(SerializeFormat::DOUBLE).deserialize(stream); } - if (formatId == TYPED_DENSE_BINARY_FORMAT_TYPE) { + if (formatId == DENSE_BINARY_FORMAT_WITH_CELLTYPE) { return DenseBinaryFormat(encoding2Format(stream.getInt1_4Bytes())).deserialize(stream); } if (formatId == MIXED_BINARY_FORMAT_TYPE) { @@ -107,7 +109,7 @@ TypedBinaryFormat::deserializeCellsOnlyFromDenseTensors(nbostream &stream, std:: if (formatId == DENSE_BINARY_FORMAT_TYPE) { return DenseBinaryFormat(SerializeFormat::DOUBLE).deserializeCellsOnly(stream, cells); } - if (formatId == TYPED_DENSE_BINARY_FORMAT_TYPE) { + if (formatId == DENSE_BINARY_FORMAT_WITH_CELLTYPE) { return DenseBinaryFormat(encoding2Format(stream.getInt1_4Bytes())).deserializeCellsOnly(stream, cells); } abort(); |