diff options
author | Colm Donelan <Colm.Donelan@arm.com> | 2021-02-12 12:43:35 +0000 |
---|---|---|
committer | Colm Donelan <colm.donelan@arm.com> | 2021-02-15 10:24:30 +0000 |
commit | 800b281e506e921006c23cd4309781b6508c0fcb (patch) | |
tree | 06c6eb1a252fa6d90460c1e821542bc1a86b067f /src/armnnSerializer/Serializer.cpp | |
parent | 0a7dc6bba5d0810fe2ed6f84b0376a8b0674c0b3 (diff) | |
download | armnn-800b281e506e921006c23cd4309781b6508c0fcb.tar.gz |
IVGCVSW-5648 Adding serializer support for m_DimensionsSpecificity
The field m_DimensionsSpecificity in TensorShape was not being serialized
and deserialized following implementation of type 1 dynamic tensors.
* Update schema.
* Add to Serializer and Deserializer.
Signed-off-by: Colm Donelan <Colm.Donelan@arm.com>
Change-Id: I7ddbdaf54c8f4b988c6cb300f90ba848a94bdad0
Diffstat (limited to 'src/armnnSerializer/Serializer.cpp')
-rw-r--r-- | src/armnnSerializer/Serializer.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/armnnSerializer/Serializer.cpp b/src/armnnSerializer/Serializer.cpp index bcdaa087fb..0586700ada 100644 --- a/src/armnnSerializer/Serializer.cpp +++ b/src/armnnSerializer/Serializer.cpp @@ -1668,6 +1668,14 @@ flatbuffers::Offset<TensorInfo> SerializerStrategy::CreateTensorInfo(const armn shape.push_back(tensorInfo.GetShape()[dim]); } + std::vector<bool> specificity; + // This assumes that the TensorShape constructors have ensured that the size of m_DimensionsSpecificity + // matches the size of dimensions. + for(unsigned int dim = 0; dim < tensorInfo.GetShape().GetNumDimensions(); ++dim) + { + specificity.push_back(tensorInfo.GetShape().GetDimensionSpecificity(dim)); + } + if (tensorInfo.HasPerAxisQuantization()) { // Create FlatBuffer TensorInfo @@ -1680,7 +1688,8 @@ flatbuffers::Offset<TensorInfo> SerializerStrategy::CreateTensorInfo(const armn m_flatBufferBuilder.CreateVector(tensorInfo.GetQuantizationScales()), tensorInfo.GetQuantizationDim().value(), static_cast<unsigned int> - (tensorInfo.GetShape().GetDimensionality())); + (tensorInfo.GetShape().GetDimensionality()), + m_flatBufferBuilder.CreateVector(specificity)); return flatBufferTensorInfo; } @@ -1693,7 +1702,8 @@ flatbuffers::Offset<TensorInfo> SerializerStrategy::CreateTensorInfo(const armn 0, 0, static_cast<unsigned int> - (tensorInfo.GetShape().GetDimensionality())); + (tensorInfo.GetShape().GetDimensionality()), + m_flatBufferBuilder.CreateVector(specificity)); return flatBufferTensorInfo; } |