IVGCVSW-4624 Add a RANK Reference Implementation
* Add Rank front end
* Add Rank reference implementation
* Add Rank serialization support
* Add Scalar serialization support
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I06e4a468c2a84e79bae2e6c5348596bbbf853b4b
diff --git a/src/armnnSerializer/Serializer.cpp b/src/armnnSerializer/Serializer.cpp
index 6555a34..8a1f771 100644
--- a/src/armnnSerializer/Serializer.cpp
+++ b/src/armnnSerializer/Serializer.cpp
@@ -2,7 +2,6 @@
// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
-
#include "Serializer.hpp"
#include <armnn/Descriptors.hpp>
@@ -851,6 +850,16 @@
CreateAnyLayer(flatBufferPermuteLayer.o, serializer::Layer::Layer_PermuteLayer);
}
+// Build FlatBuffer for Rank Layer
+void SerializerVisitor::VisitRankLayer(const armnn::IConnectableLayer* layer,
+ const char* name)
+{
+ IgnoreUnused(name);
+ auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Rank);
+ auto flatBufferRankLayer = serializer::CreateRankLayer(m_flatBufferBuilder, flatBufferBaseLayer);
+
+ CreateAnyLayer(flatBufferRankLayer.o, serializer::Layer::Layer_RankLayer);
+}
// Build FlatBuffer for Reshape Layer
void SerializerVisitor::VisitReshapeLayer(const armnn::IConnectableLayer* layer,
const armnn::ReshapeDescriptor& reshapeDescriptor,
@@ -1584,7 +1593,9 @@
tensorInfo.GetQuantizationScales()[0],
tensorInfo.GetQuantizationOffset(),
m_flatBufferBuilder.CreateVector(tensorInfo.GetQuantizationScales()),
- tensorInfo.GetQuantizationDim().value());
+ tensorInfo.GetQuantizationDim().value(),
+ static_cast<unsigned int>
+ (tensorInfo.GetShape().GetDimensionality()));
return flatBufferTensorInfo;
}
@@ -1593,7 +1604,11 @@
m_flatBufferBuilder.CreateVector(shape),
GetFlatBufferDataType(tensorInfo.GetDataType()),
tensorInfo.GetQuantizationScale(),
- tensorInfo.GetQuantizationOffset());
+ tensorInfo.GetQuantizationOffset(),
+ 0,
+ 0,
+ static_cast<unsigned int>
+ (tensorInfo.GetShape().GetDimensionality()));
return flatBufferTensorInfo;
}
@@ -1742,4 +1757,4 @@
return !stream.bad();
}
-} // namespace armnnSerializer
\ No newline at end of file
+} // namespace armnnSerializer