ArmNN
 25.11
Loading...
Searching...
No Matches
TestUtils.cpp File Reference
#include "TestUtils.hpp"
#include <armnn/utility/Assert.hpp>
#include "armnnTestUtils/Version.hpp"
Include dependency graph for TestUtils.cpp:

Go to the source code of this file.

Namespaces

namespace  armnn
 Copyright (c) 2021 ARM Limited and Contributors.

Functions

void Connect (armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
GraphGetGraphForTesting (IOptimizedNetwork *optNet)
ModelOptionsGetModelOptionsForTesting (IOptimizedNetwork *optNet)
arm::pipe::IProfilingService & GetProfilingService (armnn::RuntimeImpl *runtime)

Function Documentation

◆ Connect()

void Connect ( armnn::IConnectableLayer * from,
armnn::IConnectableLayer * to,
const armnn::TensorInfo & tensorInfo,
unsigned int fromIndex,
unsigned int toIndex )

Definition at line 14 of file TestUtils.cpp.

16{
17 ARMNN_ASSERT(from);
18 ARMNN_ASSERT(to);
19
20 try
21 {
22 from->GetOutputSlot(fromIndex).Connect(to->GetInputSlot(toIndex));
23 }
24 catch (const std::out_of_range& exc)
25 {
26 std::ostringstream message;
27
28 if (to->GetType() == armnn::LayerType::FullyConnected && toIndex == 2)
29 {
30 message << "Tried to connect bias to FullyConnected layer when bias is not enabled: ";
31 }
32
33 message << "Failed to connect to input slot "
34 << toIndex
35 << " on "
37 << " layer "
38 << std::quoted(to->GetName())
39 << " as the slot does not exist or is unavailable";
40 throw LayerValidationException(message.str());
41 }
42
43 from->GetOutputSlot(fromIndex).SetTensorInfo(tensorInfo);
44}
#define ARMNN_ASSERT(COND)
Definition Assert.hpp:14
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
virtual LayerType GetType() const =0
Returns the armnn::LayerType of this layer.
virtual const char * GetName() const =0
Returns the name of the layer.
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
virtual int Connect(IInputSlot &destination)=0
const char * GetLayerTypeAsCString(LayerType type)

References ARMNN_ASSERT, IOutputSlot::Connect(), armnn::FullyConnected, IConnectableLayer::GetInputSlot(), armnn::GetLayerTypeAsCString(), IConnectableLayer::GetName(), IConnectableLayer::GetOutputSlot(), IConnectableLayer::GetType(), and IOutputSlot::SetTensorInfo().