aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/layers/DetectionPostProcessLayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnn/layers/DetectionPostProcessLayer.cpp')
-rw-r--r--src/armnn/layers/DetectionPostProcessLayer.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/armnn/layers/DetectionPostProcessLayer.cpp b/src/armnn/layers/DetectionPostProcessLayer.cpp
index 78589229e6..3eea198f90 100644
--- a/src/armnn/layers/DetectionPostProcessLayer.cpp
+++ b/src/armnn/layers/DetectionPostProcessLayer.cpp
@@ -8,6 +8,7 @@
#include "LayerCloneBase.hpp"
#include <armnn/TypesUtils.hpp>
+#include <backendsCommon/CpuTensorHandle.hpp>
#include <backendsCommon/WorkloadData.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
@@ -34,6 +35,39 @@ DetectionPostProcessLayer* DetectionPostProcessLayer::Clone(Graph& graph) const
void DetectionPostProcessLayer::ValidateTensorShapesFromInputs()
{
VerifyLayerConnections(2, CHECK_LOCATION());
+
+ // on this level constant data should not be released.
+ BOOST_ASSERT_MSG(m_Anchors != nullptr, "DetectionPostProcessLayer: Anchors data should not be null.");
+
+ BOOST_ASSERT_MSG(GetNumOutputSlots() == 4, "DetectionPostProcessLayer: The layer should return 4 outputs.");
+
+ unsigned int detectedBoxes = m_Param.m_MaxDetections * m_Param.m_MaxClassesPerDetection;
+
+ const TensorShape& inferredDetectionBoxes = TensorShape({ 1, detectedBoxes, 4 });
+ const TensorShape& inferredDetectionScores = TensorShape({ 1, detectedBoxes });
+ const TensorShape& inferredNumberDetections = TensorShape({ 1 });
+
+ ConditionalThrowIfNotEqual<LayerValidationException>(
+ "DetectionPostProcessLayer: TensorShape set on OutputSlot[0] does not match the inferred shape.",
+ GetOutputSlot(0).GetTensorInfo().GetShape(),
+ inferredDetectionBoxes);
+ ConditionalThrowIfNotEqual<LayerValidationException>(
+ "DetectionPostProcessLayer: TensorShape set on OutputSlot[1] does not match the inferred shape.",
+ GetOutputSlot(1).GetTensorInfo().GetShape(),
+ inferredDetectionScores);
+ ConditionalThrowIfNotEqual<LayerValidationException>(
+ "DetectionPostProcessLayer: TensorShape set on OutputSlot[2] does not match the inferred shape.",
+ GetOutputSlot(2).GetTensorInfo().GetShape(),
+ inferredDetectionScores);
+ ConditionalThrowIfNotEqual<LayerValidationException>(
+ "DetectionPostProcessLayer: TensorShape set on OutputSlot[3] does not match the inferred shape.",
+ GetOutputSlot(3).GetTensorInfo().GetShape(),
+ inferredNumberDetections);
+}
+
+Layer::ConstantTensors DetectionPostProcessLayer::GetConstantTensorsByRef()
+{
+ return { m_Anchors };
}
void DetectionPostProcessLayer::Accept(ILayerVisitor& visitor) const