diff options
author | Mohamed Nour Abouelseoud <mohamednour.abouelseoud@arm.com> | 2018-12-27 12:39:16 +0000 |
---|---|---|
committer | Mohamed Nour Abouelseoud <mohamednour.abouelseoud@arm.com> | 2019-01-07 11:51:21 +0000 |
commit | a1d3c6a49f35d7d3f11cc7e1b588d1d5401bdbf1 (patch) | |
tree | b5aca3b07f2935adc3abe25a14e7bd66ff5201fc /src/armnn/layers/RsqrtLayer.cpp | |
parent | d5b9e6497b03d58c671c15b9ebe8e35500171f06 (diff) | |
download | armnn-a1d3c6a49f35d7d3f11cc7e1b588d1d5401bdbf1.tar.gz |
IVGCVSW-2371 Add Rsqrt Ref implementation
*Added Unit Tests
Change-Id: I6cceb8e6dcda35ce08415f8e5ca86019a64d26e3
Diffstat (limited to 'src/armnn/layers/RsqrtLayer.cpp')
-rw-r--r-- | src/armnn/layers/RsqrtLayer.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/armnn/layers/RsqrtLayer.cpp b/src/armnn/layers/RsqrtLayer.cpp new file mode 100644 index 0000000000..d516810c68 --- /dev/null +++ b/src/armnn/layers/RsqrtLayer.cpp @@ -0,0 +1,48 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "RsqrtLayer.hpp" + +#include "LayerCloneBase.hpp" + +#include <armnn/TypesUtils.hpp> +#include <backendsCommon/WorkloadData.hpp> +#include <backendsCommon/WorkloadFactory.hpp> + +namespace armnn +{ + +RsqrtLayer::RsqrtLayer(const char* name) + : Layer(1, 1, LayerType::Rsqrt, name) +{ +} + +std::unique_ptr<IWorkload> RsqrtLayer::CreateWorkload(const Graph& graph, + const IWorkloadFactory& factory) const +{ + RsqrtQueueDescriptor descriptor; + return factory.CreateRsqrt(descriptor, PrepInfoAndDesc(descriptor, graph)); +} + +RsqrtLayer* RsqrtLayer::Clone(Graph& graph) const +{ + return CloneBase<RsqrtLayer>(graph, GetName()); +} + +void RsqrtLayer::ValidateTensorShapesFromInputs() +{ + VerifyLayerConnections(1, CHECK_LOCATION()); + + auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() }); + + BOOST_ASSERT(inferredShapes.size() == 1); + + ConditionalThrowIfNotEqual<LayerValidationException>( + "RsqrtLayer: TensorShape set on OutputSlot[0] does not match the inferred shape.", + GetOutputSlot(0).GetTensorInfo().GetShape(), + inferredShapes[0]); +} + +} // namespace armnn
\ No newline at end of file |