aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/layers
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/layers
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/layers')
-rw-r--r--src/armnn/layers/Convolution2dLayer.cpp29
-rw-r--r--src/armnn/layers/Convolution2dLayer.hpp17
-rw-r--r--src/armnn/layers/DepthwiseConvolution2dLayer.cpp28
-rw-r--r--src/armnn/layers/DepthwiseConvolution2dLayer.hpp18
-rw-r--r--src/armnn/layers/FullyConnectedLayer.cpp25
-rw-r--r--src/armnn/layers/FullyConnectedLayer.hpp12
6 files changed, 25 insertions, 104 deletions
diff --git a/src/armnn/layers/Convolution2dLayer.cpp b/src/armnn/layers/Convolution2dLayer.cpp
index d0233976c4..e06b45acb0 100644
--- a/src/armnn/layers/Convolution2dLayer.cpp
+++ b/src/armnn/layers/Convolution2dLayer.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -48,18 +48,8 @@ void Convolution2dLayer::SerializeLayerParameters(ParameterStringifyFunction& fn
std::unique_ptr<IWorkload> Convolution2dLayer::CreateWorkload(const IWorkloadFactory& factory) const
{
- // on this level constant data should not be released..
ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "Convolution2dLayer_CreateWorkload");
Convolution2dQueueDescriptor descriptor;
- if (m_Weight)
- {
- descriptor.m_Weight = m_Weight.get();
- }
- if (m_Param.m_BiasEnabled && m_Bias)
- {
- descriptor.m_Bias = m_Bias.get();
- }
-
SetAdditionalInfo(descriptor);
return factory.CreateWorkload(LayerType::Convolution2d, descriptor, PrepInfoAndDesc(descriptor));
@@ -68,14 +58,6 @@ std::unique_ptr<IWorkload> Convolution2dLayer::CreateWorkload(const IWorkloadFac
Convolution2dLayer* Convolution2dLayer::Clone(Graph& graph) const
{
auto layer = CloneBase<Convolution2dLayer>(graph, m_Param, GetName());
-
- layer->m_Weight = m_Weight ? m_Weight : nullptr;
-
- if (layer->m_Param.m_BiasEnabled)
- {
- layer->m_Bias = m_Bias ? m_Bias : nullptr;
- }
-
return std::move(layer);
}
@@ -140,14 +122,7 @@ void Convolution2dLayer::ValidateTensorShapesFromInputs()
Layer::ConstantTensors Convolution2dLayer::GetConstantTensorsByRef()
{
Layer::ConstantTensors tensors = GetConnectedConstantAsInputTensors();
-
- if (!tensors.empty())
- {
- return tensors;
- }
-
- // For API stability DO NOT ALTER order and add new members to the end of vector
- return {m_Weight, m_Bias};
+ return tensors;
}
void Convolution2dLayer::ExecuteStrategy(IStrategy& strategy) const
diff --git a/src/armnn/layers/Convolution2dLayer.hpp b/src/armnn/layers/Convolution2dLayer.hpp
index 02ae05f83b..f7e4dec72f 100644
--- a/src/armnn/layers/Convolution2dLayer.hpp
+++ b/src/armnn/layers/Convolution2dLayer.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
@@ -16,13 +16,6 @@ class Convolution2dLayer : public LayerWithParameters<Convolution2dDescriptor>
{
public:
- /// A unique pointer to store Weight values.
- /// @Note: Deprecated. Removal date is 23.02. Weights are stored in ConstantLayers now.
- std::shared_ptr<ConstTensorHandle> m_Weight;
- /// A unique pointer to store Bias values.
- /// @Note: Deprecated. Removal date is 23.02. Bias are stored in ConstantLayers now.
- std::shared_ptr<ConstTensorHandle> m_Bias;
-
/// Makes a workload for the Convolution2d type.
/// @param [in] graph The graph where this layer can be found.
/// @param [in] factory The workload factory which will create the workload.
@@ -48,6 +41,10 @@ public:
void SerializeLayerParameters(ParameterStringifyFunction& fn) const override;
+ /// This layer does not have any data stored, weights and bias are now stored in constant layers.
+ /// We do not want to release the data in the constant layer, that is why we override with an empty function.
+ void ReleaseConstantData() override {}
+
protected:
/// Constructor to create a Convolution2dLayer.
/// @param [in] param Convolution2dDescriptor to configure the convolution2d operation.
@@ -57,8 +54,8 @@ protected:
/// Default destructor
~Convolution2dLayer() = default;
- /// @Note Deprecated. GetConstantTensorsByRef is deprecated. m_Weights and m_Bias
- /// should be connected to layer as Constant Layers instead."
+ /// Retrieve the handles to the constant values connected to the layer.
+ /// @return A vector of the constant tensors connected to the layer.
ConstantTensors GetConstantTensorsByRef() override;
};
diff --git a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
index dcd800e367..4c97437a1c 100644
--- a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
+++ b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -50,16 +50,6 @@ void DepthwiseConvolution2dLayer::SerializeLayerParameters(ParameterStringifyFun
std::unique_ptr<IWorkload> DepthwiseConvolution2dLayer::CreateWorkload(const IWorkloadFactory& factory) const
{
DepthwiseConvolution2dQueueDescriptor descriptor;
-
- if (m_Weight)
- {
- descriptor.m_Weight = m_Weight.get();
- }
- if (m_Param.m_BiasEnabled && m_Bias)
- {
- descriptor.m_Bias = m_Bias.get();
- }
-
SetAdditionalInfo(descriptor);
return factory.CreateWorkload(LayerType::DepthwiseConvolution2d, descriptor, PrepInfoAndDesc(descriptor));
@@ -68,13 +58,6 @@ std::unique_ptr<IWorkload> DepthwiseConvolution2dLayer::CreateWorkload(const IWo
DepthwiseConvolution2dLayer* DepthwiseConvolution2dLayer::Clone(Graph& graph) const
{
auto layer = CloneBase<DepthwiseConvolution2dLayer>(graph, m_Param, GetName());
- layer->m_Weight = m_Weight ? m_Weight : nullptr;
-
- if (layer->m_Param.m_BiasEnabled)
- {
- layer->m_Bias = m_Bias ? m_Bias : nullptr;
- }
-
return std::move(layer);
}
@@ -143,14 +126,7 @@ void DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs()
Layer::ConstantTensors DepthwiseConvolution2dLayer::GetConstantTensorsByRef()
{
Layer::ConstantTensors tensors = GetConnectedConstantAsInputTensors();
-
- if (!tensors.empty())
- {
- return tensors;
- }
-
- // For API stability DO NOT ALTER order and add new members to the end of vector
- return {m_Weight, m_Bias};
+ return tensors;
}
void DepthwiseConvolution2dLayer::ExecuteStrategy(IStrategy& strategy) const
diff --git a/src/armnn/layers/DepthwiseConvolution2dLayer.hpp b/src/armnn/layers/DepthwiseConvolution2dLayer.hpp
index baae7f122a..ef7410f1d3 100644
--- a/src/armnn/layers/DepthwiseConvolution2dLayer.hpp
+++ b/src/armnn/layers/DepthwiseConvolution2dLayer.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
@@ -15,12 +15,6 @@ class ScopedTensorHandle;
class DepthwiseConvolution2dLayer : public LayerWithParameters<DepthwiseConvolution2dDescriptor>
{
public:
- /// A unique pointer to store Weight values.
- /// @Note Deprecated. Removal date is 23.02. Weights are stored in ConstantLayers now.
- std::shared_ptr<ConstTensorHandle> m_Weight;
- /// A unique pointer to store Bias values.
- /// @Note Deprecated. Removal date is 23.02. Bias are stored in ConstantLayers now.
- std::shared_ptr<ConstTensorHandle> m_Bias;
/// Makes a workload for the DepthwiseConvolution2d type.
/// @param [in] graph The graph where this layer can be found.
@@ -47,6 +41,10 @@ public:
void SerializeLayerParameters(ParameterStringifyFunction& fn) const override;
+ /// This layer does not have any data stored, weights and bias are now stored in constant layers.
+ /// We do not want to release the data in the constant layer, that is why we override with an empty function.
+ void ReleaseConstantData() override {}
+
protected:
/// Constructor to create a DepthwiseConvolution2dLayer.
/// @param [in] param DepthwiseConvolution2dDescriptor to configure the depthwise convolution2d.
@@ -56,10 +54,8 @@ protected:
/// Default destructor
~DepthwiseConvolution2dLayer() = default;
- /// Retrieve the handles to the constant values stored by the layer.
- /// @return A vector of the constant tensors stored by this layer.
- /// @Note Deprecated. GetConstantTensorsByRef is deprecated. m_Weights and m_Bias
- /// should be connected to layer as Constant Layers instead."
+ /// Retrieve the handles to the constant values connected to the layer.
+ /// @return A vector of the constant tensors connected to the layer.
ConstantTensors GetConstantTensorsByRef() override;
};
diff --git a/src/armnn/layers/FullyConnectedLayer.cpp b/src/armnn/layers/FullyConnectedLayer.cpp
index c20bc8d167..05c53961e3 100644
--- a/src/armnn/layers/FullyConnectedLayer.cpp
+++ b/src/armnn/layers/FullyConnectedLayer.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "FullyConnectedLayer.hpp"
@@ -22,27 +22,13 @@ FullyConnectedLayer::FullyConnectedLayer(const FullyConnectedDescriptor& param,
std::unique_ptr<IWorkload> FullyConnectedLayer::CreateWorkload(const IWorkloadFactory& factory) const
{
FullyConnectedQueueDescriptor descriptor;
- if (m_Weight)
- {
- descriptor.m_Weight = m_Weight.get();
- }
- if (m_Param.m_BiasEnabled && m_Bias)
- {
- descriptor.m_Bias = m_Bias.get();
- }
SetAdditionalInfo(descriptor);
-
return factory.CreateWorkload(LayerType::FullyConnected, descriptor, PrepInfoAndDesc(descriptor));
}
FullyConnectedLayer* FullyConnectedLayer::Clone(Graph& graph) const
{
auto layer = CloneBase<FullyConnectedLayer>(graph, m_Param, GetName());
- layer->m_Weight = m_Weight ? m_Weight : nullptr;
- if (layer->m_Param.m_BiasEnabled)
- {
- layer->m_Bias = m_Bias ? m_Bias : nullptr;
- }
return std::move(layer);
}
@@ -78,14 +64,7 @@ void FullyConnectedLayer::ValidateTensorShapesFromInputs()
Layer::ConstantTensors FullyConnectedLayer::GetConstantTensorsByRef()
{
Layer::ConstantTensors tensors = GetConnectedConstantAsInputTensors();
-
- if (!tensors.empty())
- {
- return tensors;
- }
-
- // For API stability DO NOT ALTER order and add new members to the end of vector
- return {m_Weight, m_Bias};
+ return tensors;
}
void FullyConnectedLayer::ExecuteStrategy(IStrategy& strategy) const
diff --git a/src/armnn/layers/FullyConnectedLayer.hpp b/src/armnn/layers/FullyConnectedLayer.hpp
index 07f4a936f9..f3ca696b62 100644
--- a/src/armnn/layers/FullyConnectedLayer.hpp
+++ b/src/armnn/layers/FullyConnectedLayer.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
@@ -15,12 +15,6 @@ class ScopedTensorHandle;
class FullyConnectedLayer : public LayerWithParameters<FullyConnectedDescriptor>
{
public:
- /// A unique pointer to store Weight values.
- /// @Note: Deprecated. Removal date is 23.02. Weights are stored in ConstantLayers now.
- std::shared_ptr<ConstTensorHandle> m_Weight;
- /// A unique pointer to store Bias values.
- /// @Note: Deprecated. Removal date is 23.02. Bias are stored in ConstantLayers now.
- std::shared_ptr<ConstTensorHandle> m_Bias;
/// Makes a workload for the FullyConnected type.
/// @param [in] graph The graph where this layer can be found.
@@ -45,6 +39,10 @@ public:
void ExecuteStrategy(IStrategy& strategy) const override;
+ /// This layer does not have any data stored, weights and bias are now stored in constant layers.
+ /// We do not want to release the data in the constant layer, that is why we override with an empty function.
+ void ReleaseConstantData() override {}
+
protected:
/// Constructor to create a FullyConnectedLayer.
/// @param [in] param FullyConnectedDescriptor to configure the fully connected operation.