aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrancis Murtagh <francis.murtagh@arm.com>2022-02-09 15:13:38 +0000
committerFrancis Murtagh <francis.murtagh@arm.com>2022-02-16 10:26:39 +0000
commitbb6c6490b43036400e3c2ff90d3beafe074ab0b1 (patch)
tree49c05a44c00b0f009fa3913c45dc20496762ec5e /src
parent154258132955f0bd74ef26a0cc20b7daca4d7b09 (diff)
downloadarmnn-bb6c6490b43036400e3c2ff90d3beafe074ab0b1.tar.gz
IVGCVSW-6399 Remove deprecated code 22.02 (FullyConnected)
* Remove deprecated INetwork::AddFullyconnectedLayer() taking weights as argument as they are now taken as separate input layers. * Updated test that was using the deprecated function. * Remove calls in pyarmnn Signed-off-by: Francis Murtagh <francis.murtagh@arm.com> Change-Id: Ibc52ac7fa57afd9033eb226bbc24a09e88a7d361
Diffstat (limited to 'src')
-rw-r--r--src/armnn/Network.cpp19
-rw-r--r--src/armnnSerializer/test/SerializerTests.cpp17
-rw-r--r--src/backends/cl/test/ClCustomAllocatorTests.cpp32
3 files changed, 24 insertions, 44 deletions
diff --git a/src/armnn/Network.cpp b/src/armnn/Network.cpp
index 8ec8b42ee5..408003ec91 100644
--- a/src/armnn/Network.cpp
+++ b/src/armnn/Network.cpp
@@ -171,25 +171,6 @@ IConnectableLayer* INetwork::AddFullyConnectedLayer(const FullyConnectedDescript
return pNetworkImpl->AddFullyConnectedLayer(fullyConnectedDescriptor, name);
}
-IConnectableLayer* INetwork::AddFullyConnectedLayer(const FullyConnectedDescriptor& fullyConnectedDescriptor,
- const ConstTensor& weights,
- const Optional<ConstTensor>& biases,
- const char* name)
-{
- return pNetworkImpl->AddFullyConnectedLayer(fullyConnectedDescriptor,
- armnn::Optional<ConstTensor>(weights),
- biases,
- name);
-}
-
-IConnectableLayer* INetwork::AddFullyConnectedLayer(const FullyConnectedDescriptor& fullyConnectedDescriptor,
- const Optional<ConstTensor>& weights,
- const Optional<ConstTensor>& biases,
- const char* name)
-{
- return pNetworkImpl->AddFullyConnectedLayer(fullyConnectedDescriptor, weights, biases, name);
-}
-
IConnectableLayer* INetwork::AddPermuteLayer(const PermuteDescriptor& permuteDescriptor,
const char* name)
{
diff --git a/src/armnnSerializer/test/SerializerTests.cpp b/src/armnnSerializer/test/SerializerTests.cpp
index 632a80a748..966dc6c669 100644
--- a/src/armnnSerializer/test/SerializerTests.cpp
+++ b/src/armnnSerializer/test/SerializerTests.cpp
@@ -927,22 +927,21 @@ TEST_CASE("SerializeFullyConnected")
armnn::INetworkPtr network = armnn::INetwork::Create();
armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
-
- // Old way of handling constant tensors.
- ARMNN_NO_DEPRECATE_WARN_BEGIN
+ armnn::IConnectableLayer* const weightsInputLayer = network->AddInputLayer(1);
+ armnn::IConnectableLayer* const biasInputLayer = network->AddInputLayer(2);
armnn::IConnectableLayer* const fullyConnectedLayer =
- network->AddFullyConnectedLayer(descriptor,
- weights,
- armnn::Optional<armnn::ConstTensor>(biases),
- layerName.c_str());
- ARMNN_NO_DEPRECATE_WARN_END
-
+ network->AddFullyConnectedLayer(descriptor,
+ layerName.c_str());
armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
inputLayer->GetOutputSlot(0).Connect(fullyConnectedLayer->GetInputSlot(0));
+ weightsInputLayer->GetOutputSlot(0).Connect(fullyConnectedLayer->GetInputSlot(1));
+ biasInputLayer->GetOutputSlot(0).Connect(fullyConnectedLayer->GetInputSlot(2));
fullyConnectedLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
+ weightsInputLayer->GetOutputSlot(0).SetTensorInfo(weightsInfo);
+ biasInputLayer->GetOutputSlot(0).SetTensorInfo(biasesInfo);
fullyConnectedLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
diff --git a/src/backends/cl/test/ClCustomAllocatorTests.cpp b/src/backends/cl/test/ClCustomAllocatorTests.cpp
index c09d0b2bc2..139e688dc2 100644
--- a/src/backends/cl/test/ClCustomAllocatorTests.cpp
+++ b/src/backends/cl/test/ClCustomAllocatorTests.cpp
@@ -40,7 +40,6 @@ public:
}
size_t space = size + alignment + alignment;
auto allocatedMemPtr = std::malloc(space * sizeof(size_t));
-
if (std::align(alignment, size, allocatedMemPtr, space) == nullptr)
{
throw armnn::Exception("SampleClBackendCustomAllocator::Alignment failed");
@@ -63,7 +62,6 @@ public:
armnn::INetworkPtr CreateTestNetwork(armnn::TensorInfo& inputTensorInfo)
{
using namespace armnn;
- INetworkPtr myNetwork = INetwork::Create();
armnn::FullyConnectedDescriptor fullyConnectedDesc;
float weightsData[] = {1.0f}; // Identity
@@ -71,25 +69,27 @@ armnn::INetworkPtr CreateTestNetwork(armnn::TensorInfo& inputTensorInfo)
weightsInfo.SetConstant(true);
armnn::ConstTensor weights(weightsInfo, weightsData);
- ARMNN_NO_DEPRECATE_WARN_BEGIN
- IConnectableLayer* fullyConnected = myNetwork->AddFullyConnectedLayer(fullyConnectedDesc,
- weights,
- EmptyOptional(),
- "fully connected");
- ARMNN_NO_DEPRECATE_WARN_END
- IConnectableLayer* InputLayer = myNetwork->AddInputLayer(0);
- IConnectableLayer* OutputLayer = myNetwork->AddOutputLayer(0);
- InputLayer->GetOutputSlot(0).Connect(fullyConnected->GetInputSlot(0));
- fullyConnected->GetOutputSlot(0).Connect(OutputLayer->GetInputSlot(0));
+ armnn::INetworkPtr network = armnn::INetwork::Create();
+ armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
+ armnn::IConnectableLayer* const weightsLayer = network->AddConstantLayer(weights, "Weights");
+ armnn::IConnectableLayer* const fullyConnectedLayer =
+ network->AddFullyConnectedLayer(fullyConnectedDesc, "fully connected");
+ armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
+
+ inputLayer->GetOutputSlot(0).Connect(fullyConnectedLayer->GetInputSlot(0));
+ weightsLayer->GetOutputSlot(0).Connect(fullyConnectedLayer->GetInputSlot(1));
+ fullyConnectedLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
+
+ weightsLayer->GetOutputSlot(0).SetTensorInfo(weightsInfo);
//Set the tensors in the network.
- InputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
+ inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
TensorInfo outputTensorInfo(TensorShape({1, 1}), DataType::Float32);
- fullyConnected->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
+ fullyConnectedLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
- return myNetwork;
+ return network;
}
TEST_SUITE("ClCustomAllocatorTests")
@@ -216,4 +216,4 @@ TEST_CASE("ClCustomAllocatorGpuAccNullptrTest")
"Expected exception in RuntimeImpl::RuntimeImpl() as allocator was nullptr.");
}
-} // test suite ClCustomAllocatorTests \ No newline at end of file
+} // test suite ClCustomAllocatorTests