aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/optimizations/RedirectMembersToConstantInputs.hpp
diff options
context:
space:
mode:
authorMike Kelly <mike.kelly@arm.com>2022-11-25 13:55:24 +0000
committermike.kelly <mike.kelly@arm.com>2022-12-12 15:58:21 +0000
commitec67a0f08e0f96a5aebf3cac65331c67f6649f5e (patch)
tree94146a1f43c74d89d83fd5da54688ae0fc19cf85 /src/armnn/optimizations/RedirectMembersToConstantInputs.hpp
parent5383767a7a759c867235ab66bd71f88281e3bd06 (diff)
downloadarmnn-ec67a0f08e0f96a5aebf3cac65331c67f6649f5e.tar.gz
IVGCVSW-7209 Remove deprecated code due to be removed in 23.02
* Removed weights and bias from Convolution, DepthwiseConv & FullyConnected layers * Removed the weight and bias ConstTensorHandles from the QueueDescriptors * Updated Workloads to take tensors from WorkloadInfo rather than the QueueDescriptors * Removed unused RedirectMembersToConstantInputs optimization and tests. Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com> Signed-off-by: Mike Kelly <mike.kelly@arm.com> Change-Id: I9ffcdc4a1c0dff725539dd69fc435b700bd98a56
Diffstat (limited to 'src/armnn/optimizations/RedirectMembersToConstantInputs.hpp')
-rw-r--r--src/armnn/optimizations/RedirectMembersToConstantInputs.hpp90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/armnn/optimizations/RedirectMembersToConstantInputs.hpp b/src/armnn/optimizations/RedirectMembersToConstantInputs.hpp
deleted file mode 100644
index a2bad710e6..0000000000
--- a/src/armnn/optimizations/RedirectMembersToConstantInputs.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include "Optimization.hpp"
-
-#include <armnn/utility/IgnoreUnused.hpp>
-#include <armnn/utility/PolymorphicDowncast.hpp>
-
-namespace armnn
-{
-namespace optimizations
-{
-
-class RedirectMembersToConstantInputsImpl
-{
-public:
- /// Search for layers with ConstantLayers as inputs. If the inputs are constant redirect the layers member
- /// variable for ConstTensors (e.g. m_weights) to the data stored in the ConstantLayer it is connected to.
- void Run(Graph& graph, Layer& layer) const
- {
- IgnoreUnused(graph);
-
- switch (layer.GetType())
- {
- case LayerType::BatchNormalization:
- break;
- case LayerType::Convolution2d:
- RedirectWeightsAndBiases<Convolution2dLayer>(&layer);
- break;
- case LayerType::DepthwiseConvolution2d:
- RedirectWeightsAndBiases<DepthwiseConvolution2dLayer>(&layer);
- break;
- case LayerType::DetectionPostProcess:
- break;
- case LayerType::FullyConnected:
- RedirectWeightsAndBiases<FullyConnectedLayer>(&layer);
- break;
- case LayerType::Lstm:
- break;
- case LayerType::TransposeConvolution2d:
- break;
- default:
- break;
- }
- }
-
-protected:
- RedirectMembersToConstantInputsImpl() = default;
- ~RedirectMembersToConstantInputsImpl() = default;
-
-private:
- template <typename LayerT>
- static LayerT* RedirectWeightsAndBiases(Layer* layer)
- {
- LayerT* layerPtr = PolymorphicDowncast<LayerT*>(layer);
-
- // Loop through input slots to check for constant weights and biases layers.
- // Weights index = 1, Biases index = 2.
- for (unsigned int inputSlotIndex = 1; inputSlotIndex != layerPtr->GetNumInputSlots(); ++inputSlotIndex)
- {
- OutputSlot* outputSlot = layerPtr->GetInputSlot(inputSlotIndex).GetConnectedOutputSlot();
- // Debug layers should not be inserted in optimize process yet
- ARMNN_ASSERT(outputSlot->GetOwningLayer().GetType() != LayerType::Debug);
- if (outputSlot->GetOwningLayer().GetType() == LayerType::Constant)
- {
- // Get constant layer and redirect base layer member variables.
- ConstantLayer& constantLayer = dynamic_cast<ConstantLayer&>(outputSlot->GetOwningLayer());
- if (inputSlotIndex == 1)
- {
- layerPtr->m_Weight = constantLayer.m_LayerOutput;
- }
- else if (inputSlotIndex == 2)
- {
- layerPtr->m_Bias = constantLayer.m_LayerOutput;
- }
- }
- }
-
- return layerPtr;
- }
-};
-
-using RedirectMembersToConstantInputs = OptimizeForType<Layer, RedirectMembersToConstantInputsImpl>;
-
-} // namespace optimizations
-} // namespace armnn