diff options
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 |