ArmNN
 20.02
Network Class Referencefinal

Private implementation of INetwork. More...

#include <Network.hpp>

Inheritance diagram for Network:
INetwork

Public Member Functions

 Network ()
 
 ~Network ()
 
const GraphGetGraph () const
 
Status PrintGraph () override
 
profiling::ProfilingGuid GetGuid () const final
 
IConnectableLayerAddInputLayer (LayerBindingId id, const char *name=nullptr) override
 Adds an input layer to the network. More...
 
IConnectableLayerAddArgMinMaxLayer (const ArgMinMaxDescriptor &desc, const char *name=nullptr) override
 Adds an ArgMinMax layer to the network. More...
 
IConnectableLayerAddBatchToSpaceNdLayer (const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr) override
 Adds a batch to space ND layer to the network. More...
 
IConnectableLayerAddComparisonLayer (const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr) override
 Add a Comparison layer to the network. More...
 
IConnectableLayerAddConcatLayer (const ConcatDescriptor &concatDescriptor, const char *name=nullptr) override
 Adds a concatenation layer to the network. More...
 
IConnectableLayerAddConvolution2dLayer (const Convolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
 Adds a 2D convolution layer to the network. More...
 
IConnectableLayerAddConvolution2dLayer (const Convolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const char *name=nullptr) override
 
IConnectableLayerAddConvolution2dLayer (const Convolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const ConstTensor &biases, const char *name=nullptr) override
 
IConnectableLayerAddDepthToSpaceLayer (const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr) override
 Adds a depth to space layer to the network. More...
 
IConnectableLayerAddDepthwiseConvolution2dLayer (const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
 Adds a 2D depthwise convolution layer to the network. More...
 
IConnectableLayerAddDepthwiseConvolution2dLayer (const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const char *name=nullptr) override
 
IConnectableLayerAddDepthwiseConvolution2dLayer (const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const ConstTensor &biases, const char *name=nullptr) override
 
IConnectableLayerAddDequantizeLayer (const char *name=nullptr) override
 Adds a Dequantize layer to the network. More...
 
IConnectableLayerAddDetectionPostProcessLayer (const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr) override
 Adds a Detection PostProcess layer to the network. More...
 
IConnectableLayerAddElementwiseUnaryLayer (const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr) override
 Add an ElementwiseUnary layer to the network. More...
 
IConnectableLayerAddFullyConnectedLayer (const FullyConnectedDescriptor &fullyConnectedDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
 Adds a fully connected layer to the network. More...
 
IConnectableLayerAddFullyConnectedLayer (const FullyConnectedDescriptor &fullyConnectedDescriptor, const ConstTensor &weights, const char *name=nullptr) override
 
IConnectableLayerAddFullyConnectedLayer (const FullyConnectedDescriptor &fullyConnectedDescriptor, const ConstTensor &weights, const ConstTensor &biases, const char *name=nullptr) override
 
IConnectableLayerAddGatherLayer (const char *name=nullptr) override
 Add Gather layer to the network. More...
 
IConnectableLayerAddPermuteLayer (const PermuteDescriptor &permuteDescriptor, const char *name=nullptr) override
 Adds a permute layer to the network. More...
 
IConnectableLayerAddPooling2dLayer (const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr) override
 Adds a pooling layer to the network. More...
 
IConnectableLayerAddActivationLayer (const ActivationDescriptor &activationDescriptor, const char *name=nullptr) override
 Adds an activation layer to the network. More...
 
IConnectableLayerAddNormalizationLayer (const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr) override
 Adds a normalization layer to the network. More...
 
IConnectableLayerAddSliceLayer (const SliceDescriptor &sliceDescriptor, const char *name=nullptr) override
 Adds a slice layer to the network. More...
 
IConnectableLayerAddSoftmaxLayer (const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr) override
 Adds a softmax layer to the network. More...
 
IConnectableLayerAddSplitterLayer (const ViewsDescriptor &splitterDescriptor, const char *name=nullptr) override
 Adds a splitter layer to the network. More...
 
IConnectableLayerAddMergerLayer (const MergerDescriptor &mergerDescriptor, const char *name=nullptr) override
 Adds a concat layer to the network. More...
 
IConnectableLayerAddAbsLayer (const char *name=nullptr) override
 Add absolute layer to the network. More...
 
IConnectableLayerAddAdditionLayer (const char *name=nullptr) override
 Adds an addition layer to the network. More...
 
IConnectableLayerAddMultiplicationLayer (const char *name=nullptr) override
 Adds a multiplication layer to the network. More...
 
IConnectableLayerAddBatchNormalizationLayer (const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr) override
 Adds a batch normalization layer to the network. More...
 
IConnectableLayerAddResizeBilinearLayer (const ResizeBilinearDescriptor &resizeDesc, const char *name=nullptr) override
 Adds a resize bilinear layer to the network. More...
 
IConnectableLayerAddResizeLayer (const ResizeDescriptor &resizeDescriptor, const char *name=nullptr) override
 Adds a resize layer to the network. More...
 
IConnectableLayerAddInstanceNormalizationLayer (const InstanceNormalizationDescriptor &desc, const char *name=nullptr) override
 Adds an instance normalization layer to the network. More...
 
IConnectableLayerAddL2NormalizationLayer (const L2NormalizationDescriptor &desc, const char *name=nullptr) override
 Adds an L2 normalization layer to the network. More...
 
IConnectableLayerAddLogSoftmaxLayer (const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr) override
 Adds a log softmax layer to the network. More...
 
IConnectableLayerAddConstantLayer (const ConstTensor &input, const char *name=nullptr) override
 Adds a layer with no inputs and a single output, which always corresponds to the passed in constant tensor. More...
 
IConnectableLayerAddReshapeLayer (const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr) override
 Adds a reshape layer to the network. More...
 
IConnectableLayerAddSpaceToBatchNdLayer (const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr) override
 Adds a space to batch layer to the network. More...
 
IConnectableLayerAddSpaceToDepthLayer (const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr) override
 Adds a space to depth layer to the network. More...
 
IConnectableLayerAddFloorLayer (const char *name=nullptr) override
 Adds a floor layer to the network. More...
 
IConnectableLayerAddOutputLayer (LayerBindingId id, const char *name=nullptr) override
 Adds an output layer to the network. More...
 
IConnectableLayerAddLstmLayer (const LstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr) override
 Add a Lstm layer to the network. More...
 
IConnectableLayerAddDivisionLayer (const char *name=nullptr) override
 Adds a division layer to the network. More...
 
IConnectableLayerAddSubtractionLayer (const char *name=nullptr) override
 Adds a subtraction layer to the network. More...
 
IConnectableLayerAddMaximumLayer (const char *name=nullptr) override
 Add a Maximum layer to the network. More...
 
IConnectableLayerAddMeanLayer (const MeanDescriptor &meanDescriptor, const char *name=nullptr) override
 Add a Mean layer to the network. More...
 
IConnectableLayerAddPadLayer (const PadDescriptor &padDescriptor, const char *name=nullptr) override
 Adds a fully pad layer to the network. More...
 
IConnectableLayerAddQuantizeLayer (const char *name=nullptr) override
 Add a quantize layer to the network. More...
 
IConnectableLayerAddStridedSliceLayer (const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr) override
 Adds a strided slice layer to the network. More...
 
IConnectableLayerAddMinimumLayer (const char *name=nullptr) override
 Add a Minimum layer to the network. More...
 
IConnectableLayerAddGreaterLayer (const char *name=nullptr) override
 Add a Greater layer to the network. More...
 
IConnectableLayerAddEqualLayer (const char *name=nullptr) override
 Add a Equal layer to the network. More...
 
IConnectableLayerAddRsqrtLayer (const char *name=nullptr) override
 Add Reciprocal of square root layer to the network. More...
 
IConnectableLayerAddMergeLayer (const char *name=nullptr) override
 Adds a merge layer to the network. More...
 
IConnectableLayerAddSwitchLayer (const char *name=nullptr) override
 Adds a switch layer to the network. More...
 
IConnectableLayerAddPreluLayer (const char *name=nullptr) override
 Adds a PReLU layer to the network. More...
 
IConnectableLayerAddTransposeConvolution2dLayer (const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
 Adds a 2D transpose convolution layer to the network. More...
 
IConnectableLayerAddTransposeLayer (const TransposeDescriptor &transposeDescriptor, const char *name=nullptr) override
 Adds a transpose layer to the network. More...
 
IConnectableLayerAddStackLayer (const StackDescriptor &stackDescriptor, const char *name=nullptr) override
 Adds a stack layer to the network. More...
 
IConnectableLayerAddStandInLayer (const StandInDescriptor &descriptor, const char *name=nullptr) override
 Add a stand-in layer for a type unknown to the Arm NN framework. More...
 
IConnectableLayerAddQuantizedLstmLayer (const QuantizedLstmInputParams &params, const char *name=nullptr) override
 Add a QuantizedLstm layer to the network. More...
 
void Accept (ILayerVisitor &visitor) const override
 

Additional Inherited Members

- Static Public Member Functions inherited from INetwork
static INetworkCreateRaw ()
 
static INetworkPtr Create ()
 
static void Destroy (INetwork *network)
 
- Protected Member Functions inherited from INetwork
 ~INetwork ()
 

Detailed Description

Private implementation of INetwork.

Definition at line 28 of file Network.hpp.

Constructor & Destructor Documentation

◆ Network()

Network ( )

Definition at line 1025 of file Network.cpp.

1026 : m_Graph(std::make_unique<Graph>()),
1027  m_Guid(profiling::ProfilingService::Instance().NextGuid())
1028 {
1029 }
static ProfilingService & Instance()

◆ ~Network()

~Network ( )

Definition at line 1031 of file Network.cpp.

1032 {
1033 }

Member Function Documentation

◆ Accept()

void Accept ( ILayerVisitor visitor) const
overridevirtual

Implements INetwork.

Definition at line 1674 of file Network.cpp.

References Network::GetGraph().

Referenced by Network::GetGuid().

1675 {
1676  for (auto layer : GetGraph())
1677  {
1678  layer->Accept(visitor);
1679  };
1680 }
const Graph & GetGraph() const
Definition: Network.hpp:34

◆ AddAbsLayer()

IConnectableLayer * AddAbsLayer ( const char *  name = nullptr)
overridevirtual

Add absolute layer to the network.

Parameters
name- Optional name for the layer. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1295 of file Network.cpp.

References armnn::Abs, and Network::AddElementwiseUnaryLayer().

Referenced by Network::GetGuid().

1296 {
1297  return AddElementwiseUnaryLayer(ElementwiseUnaryDescriptor(UnaryOperation::Abs), name);
1298 }
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr) override
Add an ElementwiseUnary layer to the network.
Definition: Network.cpp:1058

◆ AddActivationLayer()

IConnectableLayer * AddActivationLayer ( const ActivationDescriptor activationDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds an activation layer to the network.

Parameters
activationDescriptor- ActivationDescriptor to configure the activation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1243 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1245 {
1246  return m_Graph->AddLayer<ActivationLayer>(activationDescriptor, name);
1247 }

◆ AddAdditionLayer()

IConnectableLayer * AddAdditionLayer ( const char *  name = nullptr)
overridevirtual

Adds an addition layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1300 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1301 {
1302  return m_Graph->AddLayer<AdditionLayer>(name);
1303 }

◆ AddArgMinMaxLayer()

IConnectableLayer * AddArgMinMaxLayer ( const ArgMinMaxDescriptor desc,
const char *  name = nullptr 
)
overridevirtual

Adds an ArgMinMax layer to the network.

Parameters
desc- Parameters for the L2 normalization operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1249 of file Network.cpp.

Referenced by Network::GetGuid().

1251 {
1252  return m_Graph->AddLayer<ArgMinMaxLayer>(argMinMaxDescriptor, name);
1253 }

◆ AddBatchNormalizationLayer()

IConnectableLayer * AddBatchNormalizationLayer ( const BatchNormalizationDescriptor desc,
const ConstTensor mean,
const ConstTensor variance,
const ConstTensor beta,
const ConstTensor gamma,
const char *  name = nullptr 
)
overridevirtual

Adds a batch normalization layer to the network.

Parameters
mean- Pre-calculated mean for each channel.
variance- Pre-calculated variance for each channel.
beta- Per-channel additive factor.
gamma- Per-channel multiplicative factor.
Returns
- Interface for configuring the layer.
Parameters
name- Optional name for the layer.

Implements INetwork.

Definition at line 1315 of file Network.cpp.

References BatchNormalizationLayer::m_Mean.

Referenced by BOOST_AUTO_TEST_CASE(), armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1321 {
1322  const auto layer = m_Graph->AddLayer<BatchNormalizationLayer>(desc, name);
1323 
1324  layer->m_Mean = std::make_unique<ScopedCpuTensorHandle>(mean);
1325  layer->m_Variance = std::make_unique<ScopedCpuTensorHandle>(variance);
1326  layer->m_Beta = std::make_unique<ScopedCpuTensorHandle>(beta);
1327  layer->m_Gamma = std::make_unique<ScopedCpuTensorHandle>(gamma);
1328 
1329  return layer;
1330 }

◆ AddBatchToSpaceNdLayer()

IConnectableLayer * AddBatchToSpaceNdLayer ( const BatchToSpaceNdDescriptor batchToSpaceNdDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a batch to space ND layer to the network.

Parameters
batchToSpaceNdDescriptor- Description of the layer.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1046 of file Network.cpp.

Referenced by Network::GetGuid().

1048 {
1049  return m_Graph->AddLayer<BatchToSpaceNdLayer>(batchToSpaceNdDescriptor, name);
1050 }

◆ AddComparisonLayer()

IConnectableLayer * AddComparisonLayer ( const ComparisonDescriptor comparisonDescriptor,
const char *  name = nullptr 
)
overridevirtual

Add a Comparison layer to the network.

Parameters
name- Optional name for the layer.
desc- Descriptor for the comparison operation. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1052 of file Network.cpp.

Referenced by Network::AddEqualLayer(), Network::AddGreaterLayer(), and Network::GetGuid().

1054 {
1055  return m_Graph->AddLayer<ComparisonLayer>(comparisonDescriptor, name);
1056 }

◆ AddConcatLayer()

IConnectableLayer * AddConcatLayer ( const ConcatDescriptor concatDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a concatenation layer to the network.

Parameters
concatDescriptor- ConcatDescriptor (synonym for OriginsDescriptor) to configure the concatenation process. Number of Views must be equal to the number of inputs, and their order must match - e.g. first view corresponds to the first input, second view to the second input, etc....
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1111 of file Network.cpp.

References OptionalBase::has_value(), Convolution2dDescriptor::m_BiasEnabled, Convolution2dLayer::m_Weight, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by Network::AddMergerLayer(), BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1113 {
1114  return m_Graph->AddLayer<ConcatLayer>(concatDescriptor, name);
1115 }

◆ AddConstantLayer()

IConnectableLayer * AddConstantLayer ( const ConstTensor input,
const char *  name = nullptr 
)
overridevirtual

Adds a layer with no inputs and a single output, which always corresponds to the passed in constant tensor.

Parameters
input- Tensor to be provided as the only output of the layer. The layer will maintain its own copy of the tensor data, meaning the memory referenced by input can be freed or reused after this function is called.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1368 of file Network.cpp.

References ConstantLayer::m_LayerOutput.

Referenced by armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1369 {
1370  auto layer = m_Graph->AddLayer<ConstantLayer>(name);
1371 
1372  layer->m_LayerOutput = std::make_unique<ScopedCpuTensorHandle>(input);
1373 
1374  return layer;
1375 }

◆ AddConvolution2dLayer() [1/3]

IConnectableLayer * AddConvolution2dLayer ( const Convolution2dDescriptor convolution2dDescriptor,
const ConstTensor weights,
const Optional< ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Adds a 2D convolution layer to the network.

Parameters
convolution2dDescriptor- Description of the 2D convolution layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data. If specified, must match the output tensor shape.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1139 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1143 {
1144  return AddConvolution2dLayerImpl(convolution2dDescriptor, weights, biases, name);
1145 }

◆ AddConvolution2dLayer() [2/3]

IConnectableLayer * AddConvolution2dLayer ( const Convolution2dDescriptor convolution2dDescriptor,
const ConstTensor weights,
const char *  name = nullptr 
)
overridevirtual

Implements INetwork.

Definition at line 1147 of file Network.cpp.

1150 {
1151  Optional<ConstTensor> biases;
1152  return AddConvolution2dLayerImpl(convolution2dDescriptor, weights, biases, name);
1153 }

◆ AddConvolution2dLayer() [3/3]

IConnectableLayer * AddConvolution2dLayer ( const Convolution2dDescriptor convolution2dDescriptor,
const ConstTensor weights,
const ConstTensor biases,
const char *  name = nullptr 
)
overridevirtual

Implements INetwork.

Definition at line 1155 of file Network.cpp.

References OptionalBase::has_value(), DepthwiseConvolution2dDescriptor::m_BiasEnabled, DepthwiseConvolution2dLayer::m_Weight, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

1159 {
1160  Optional<ConstTensor> optionalBiases(biases);
1161  return AddConvolution2dLayerImpl(convolution2dDescriptor, weights, optionalBiases, name);
1162 }

◆ AddDepthToSpaceLayer()

IConnectableLayer * AddDepthToSpaceLayer ( const DepthToSpaceDescriptor depthToSpaceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a depth to space layer to the network.

Parameters
depthToSpaceDescriptor- Parameters for the depth to space operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1187 of file Network.cpp.

Referenced by Network::GetGuid().

1189 {
1190  return m_Graph->AddLayer<DepthToSpaceLayer>(depthToSpaceDescriptor, name);
1191 }

◆ AddDepthwiseConvolution2dLayer() [1/3]

IConnectableLayer * AddDepthwiseConvolution2dLayer ( const DepthwiseConvolution2dDescriptor convolution2dDescriptor,
const ConstTensor weights,
const Optional< ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Adds a 2D depthwise convolution layer to the network.

Parameters
convolution2dDescriptor- Description of the 2D depthwise convolution layer.
weights- Tensor for the weights. Expected format: [channelMultiplier, inputChannels, height, width].
biasesOptional tensor for the bias data. If specified, must match the output tensor shape.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1193 of file Network.cpp.

Referenced by armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1198 {
1199  return AddDepthwiseConvolution2dLayerImpl(convolution2dDescriptor, weights, biases, name);
1200 }

◆ AddDepthwiseConvolution2dLayer() [2/3]

IConnectableLayer * AddDepthwiseConvolution2dLayer ( const DepthwiseConvolution2dDescriptor convolution2dDescriptor,
const ConstTensor weights,
const char *  name = nullptr 
)
overridevirtual

Implements INetwork.

Definition at line 1202 of file Network.cpp.

1206 {
1207  Optional<ConstTensor> biases;
1208  return AddDepthwiseConvolution2dLayerImpl(convolution2dDescriptor, weights, biases, name);
1209 }

◆ AddDepthwiseConvolution2dLayer() [3/3]

IConnectableLayer * AddDepthwiseConvolution2dLayer ( const DepthwiseConvolution2dDescriptor convolution2dDescriptor,
const ConstTensor weights,
const ConstTensor biases,
const char *  name = nullptr 
)
overridevirtual

Implements INetwork.

Definition at line 1211 of file Network.cpp.

1216 {
1217  Optional<ConstTensor> optionalBiases(biases);
1218  return AddDepthwiseConvolution2dLayerImpl(convolution2dDescriptor, weights, optionalBiases, name);
1219 }

◆ AddDequantizeLayer()

IConnectableLayer * AddDequantizeLayer ( const char *  name = nullptr)
overridevirtual

Adds a Dequantize layer to the network.

Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1549 of file Network.cpp.

Referenced by Network::GetGuid().

1550 {
1551  return m_Graph->AddLayer<DequantizeLayer>(name);
1552 }

◆ AddDetectionPostProcessLayer()

IConnectableLayer * AddDetectionPostProcessLayer ( const DetectionPostProcessDescriptor descriptor,
const ConstTensor anchors,
const char *  name = nullptr 
)
overridevirtual

Adds a Detection PostProcess layer to the network.

Parameters
descriptor- Description of the Detection PostProcess layer.
anchors- Tensor for anchors.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1221 of file Network.cpp.

References anchors(), and DetectionPostProcessLayer::m_Anchors.

Referenced by Network::GetGuid().

1223 {
1224  const auto layer = m_Graph->AddLayer<DetectionPostProcessLayer>(descriptor, name);
1225 
1226  layer->m_Anchors = std::make_unique<ScopedCpuTensorHandle>(anchors);
1227 
1228  return layer;
1229 }
std::vector< float > anchors({ 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 10.5f, 1.0f, 1.0f, 0.5f, 10.5f, 1.0f, 1.0f, 0.5f, 100.5f, 1.0f, 1.0f })

◆ AddDivisionLayer()

IConnectableLayer * AddDivisionLayer ( const char *  name = nullptr)
overridevirtual

Adds a division layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1524 of file Network.cpp.

Referenced by Network::GetGuid().

1525 {
1526  return m_Graph->AddLayer<DivisionLayer>(name);
1527 }

◆ AddElementwiseUnaryLayer()

IConnectableLayer * AddElementwiseUnaryLayer ( const ElementwiseUnaryDescriptor elementwiseUnaryDescriptor,
const char *  name = nullptr 
)
overridevirtual

Add an ElementwiseUnary layer to the network.

Parameters
name- Optional name for the layer.
desc- Descriptor for the elementwiseUnary operation. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1058 of file Network.cpp.

References OptionalBase::has_value(), FullyConnectedDescriptor::m_BiasEnabled, FullyConnectedLayer::m_Weight, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by Network::AddAbsLayer(), Network::AddRsqrtLayer(), and Network::GetGuid().

1060 {
1061  return m_Graph->AddLayer<ElementwiseUnaryLayer>(elementwiseUnaryDescriptor, name);
1062 }

◆ AddEqualLayer()

IConnectableLayer * AddEqualLayer ( const char *  name = nullptr)
overridevirtual

Add a Equal layer to the network.

Parameters
name- Optional name for the layer. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1565 of file Network.cpp.

References Network::AddComparisonLayer(), and armnn::Equal.

Referenced by Network::GetGuid().

1566 {
1567  return AddComparisonLayer(ComparisonDescriptor(ComparisonOperation::Equal), name);
1568 }
IConnectableLayer * AddComparisonLayer(const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr) override
Add a Comparison layer to the network.
Definition: Network.cpp:1052

◆ AddFloorLayer()

IConnectableLayer * AddFloorLayer ( const char *  name = nullptr)
overridevirtual

Adds a floor layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1395 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1396 {
1397  return m_Graph->AddLayer<FloorLayer>(name);
1398 }

◆ AddFullyConnectedLayer() [1/3]

IConnectableLayer * AddFullyConnectedLayer ( const FullyConnectedDescriptor fullyConnectedDescriptor,
const ConstTensor weights,
const Optional< ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Adds a fully connected layer to the network.

Parameters
fullyConnectedDescriptor- Description of the fully connected layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1086 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1090 {
1091  return AddFullyConnectedLayerImpl(fullyConnectedDescriptor, weights, biases, name);
1092 }

◆ AddFullyConnectedLayer() [2/3]

IConnectableLayer * AddFullyConnectedLayer ( const FullyConnectedDescriptor fullyConnectedDescriptor,
const ConstTensor weights,
const char *  name = nullptr 
)
overridevirtual

Implements INetwork.

Definition at line 1094 of file Network.cpp.

1097 {
1098  Optional<ConstTensor> biases;
1099  return AddFullyConnectedLayerImpl(fullyConnectedDescriptor, weights, biases, name);
1100 }

◆ AddFullyConnectedLayer() [3/3]

IConnectableLayer * AddFullyConnectedLayer ( const FullyConnectedDescriptor fullyConnectedDescriptor,
const ConstTensor weights,
const ConstTensor biases,
const char *  name = nullptr 
)
overridevirtual

Implements INetwork.

Definition at line 1102 of file Network.cpp.

1106 {
1107  Optional<ConstTensor> optionalBiases(biases);
1108  return AddFullyConnectedLayerImpl(fullyConnectedDescriptor, weights, optionalBiases, name);
1109 }

◆ AddGatherLayer()

IConnectableLayer * AddGatherLayer ( const char *  name = nullptr)
overridevirtual

Add Gather layer to the network.

Parameters
name- Optional name for the layer. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1575 of file Network.cpp.

Referenced by Network::GetGuid().

1576 {
1577  return m_Graph->AddLayer<GatherLayer>(name);
1578 }

◆ AddGreaterLayer()

IConnectableLayer * AddGreaterLayer ( const char *  name = nullptr)
overridevirtual

Add a Greater layer to the network.

Parameters
name- Optional name for the layer. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1560 of file Network.cpp.

References Network::AddComparisonLayer(), and armnn::Greater.

Referenced by Network::GetGuid().

1561 {
1562  return AddComparisonLayer(ComparisonDescriptor(ComparisonOperation::Greater), name);
1563 }
IConnectableLayer * AddComparisonLayer(const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr) override
Add a Comparison layer to the network.
Definition: Network.cpp:1052

◆ AddInputLayer()

IConnectableLayer * AddInputLayer ( LayerBindingId  id,
const char *  name = nullptr 
)
overridevirtual

Adds an input layer to the network.

Parameters
id- User generated id to uniquely identify a particular input. The same id needs to be specified. when passing the inputs to the IRuntime::EnqueueWorkload() function.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1041 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1042 {
1043  return m_Graph->AddLayer<InputLayer>(id, name);
1044 }

◆ AddInstanceNormalizationLayer()

IConnectableLayer * AddInstanceNormalizationLayer ( const InstanceNormalizationDescriptor desc,
const char *  name = nullptr 
)
overridevirtual

Adds an instance normalization layer to the network.

Parameters
desc- Parameters for the instance normalization operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1350 of file Network.cpp.

Referenced by Network::GetGuid().

1352 {
1353  return m_Graph->AddLayer<InstanceNormalizationLayer>(desc, name);
1354 }

◆ AddL2NormalizationLayer()

IConnectableLayer * AddL2NormalizationLayer ( const L2NormalizationDescriptor desc,
const char *  name = nullptr 
)
overridevirtual

Adds an L2 normalization layer to the network.

Normalization is performed along dimension 1, but requires a 4d input.

Parameters
desc- Parameters for the L2 normalization operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1356 of file Network.cpp.

Referenced by Network::GetGuid().

1358 {
1359  return m_Graph->AddLayer<L2NormalizationLayer>(desc, name);
1360 }

◆ AddLogSoftmaxLayer()

IConnectableLayer * AddLogSoftmaxLayer ( const LogSoftmaxDescriptor logSoftmaxDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a log softmax layer to the network.

Parameters
logSoftmaxDescriptor- LogSoftmaxDescriptor to configure the log softmax.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1362 of file Network.cpp.

Referenced by Network::GetGuid().

1364 {
1365  return m_Graph->AddLayer<LogSoftmaxLayer>(desc, name);
1366 }

◆ AddLstmLayer()

IConnectableLayer * AddLstmLayer ( const LstmDescriptor descriptor,
const LstmInputParams params,
const char *  name = nullptr 
)
overridevirtual

Add a Lstm layer to the network.

Parameters
descriptor- Parameters for the Lstm operation
params- Weights and biases for the LSTM cell
name- Optional name for the layer
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1400 of file Network.cpp.

References LstmLayer::m_BasicParameters, LstmInputParams::m_CellBias, LstmInputParams::m_CellLayerNormWeights, LstmInputParams::m_CellToForgetWeights, LstmInputParams::m_CellToInputWeights, LstmInputParams::m_CellToOutputWeights, LstmInputParams::m_ForgetGateBias, LstmInputParams::m_ForgetLayerNormWeights, LstmInputParams::m_InputGateBias, LstmInputParams::m_InputLayerNormWeights, LstmInputParams::m_InputToCellWeights, LstmInputParams::m_InputToForgetWeights, LstmBasicParameters::m_InputToForgetWeights, LstmInputParams::m_InputToInputWeights, LstmInputParams::m_InputToOutputWeights, LstmInputParams::m_OutputGateBias, LstmInputParams::m_OutputLayerNormWeights, LstmInputParams::m_ProjectionBias, LstmInputParams::m_ProjectionWeights, LstmInputParams::m_RecurrentToCellWeights, LstmInputParams::m_RecurrentToForgetWeights, LstmInputParams::m_RecurrentToInputWeights, and LstmInputParams::m_RecurrentToOutputWeights.

Referenced by armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1403 {
1404  const auto layer = m_Graph->AddLayer<LstmLayer>(descriptor, name);
1405 
1406  //Lstm Basic Parameters
1407  layer->m_BasicParameters.m_InputToForgetWeights =
1408  std::make_unique<ScopedCpuTensorHandle>(*(params.m_InputToForgetWeights));
1409  layer->m_BasicParameters.m_InputToCellWeights =
1410  std::make_unique<ScopedCpuTensorHandle>(*(params.m_InputToCellWeights));
1411  layer->m_BasicParameters.m_InputToOutputWeights =
1412  std::make_unique<ScopedCpuTensorHandle>(*(params.m_InputToOutputWeights));
1413  layer->m_BasicParameters.m_RecurrentToForgetWeights =
1414  std::make_unique<ScopedCpuTensorHandle>(*(params.m_RecurrentToForgetWeights));
1415  layer->m_BasicParameters.m_RecurrentToCellWeights =
1416  std::make_unique<ScopedCpuTensorHandle>(*(params.m_RecurrentToCellWeights));
1417  layer->m_BasicParameters.m_RecurrentToOutputWeights =
1418  std::make_unique<ScopedCpuTensorHandle>(*(params.m_RecurrentToOutputWeights));
1419  layer->m_BasicParameters.m_ForgetGateBias =
1420  std::make_unique<ScopedCpuTensorHandle>(*(params.m_ForgetGateBias));
1421  layer->m_BasicParameters.m_CellBias =
1422  std::make_unique<ScopedCpuTensorHandle>(*(params.m_CellBias));
1423  layer->m_BasicParameters.m_OutputGateBias =
1424  std::make_unique<ScopedCpuTensorHandle>(*(params.m_OutputGateBias));
1425 
1426  //Lstm Cifg parameters
1427  if(!descriptor.m_CifgEnabled)
1428  {
1429  if(params.m_InputToInputWeights == nullptr)
1430  {
1431  throw InvalidArgumentException("AddLstmLayer: Input To Input Weights cannot be NULL");
1432  }
1433  if(params.m_RecurrentToInputWeights == nullptr)
1434  {
1435  throw InvalidArgumentException(
1436  "AddLstmLayer: Recurrent To Input Weights cannot be NULL");
1437  }
1438  if(params.m_InputGateBias == nullptr)
1439  {
1440  throw InvalidArgumentException("AddLstmLayer: Input Gate Bias cannot be NULL");
1441  }
1442  layer->m_CifgParameters.m_InputToInputWeights =
1443  std::make_unique<ScopedCpuTensorHandle>(*(params.m_InputToInputWeights));
1444  layer->m_CifgParameters.m_RecurrentToInputWeights =
1445  std::make_unique<ScopedCpuTensorHandle>(*(params.m_RecurrentToInputWeights));
1446  // In the VTS tests, cell-to-input weights may be null, even if the other CIFG params are not.
1447  if(params.m_CellToInputWeights != nullptr)
1448  {
1449  layer->m_CifgParameters.m_CellToInputWeights =
1450  std::make_unique<ScopedCpuTensorHandle>(*(params.m_CellToInputWeights));
1451  }
1452  layer->m_CifgParameters.m_InputGateBias =
1453  std::make_unique<ScopedCpuTensorHandle>(*(params.m_InputGateBias));
1454  }
1455 
1456  //Lstm projection parameters
1457  if(descriptor.m_ProjectionEnabled)
1458  {
1459  if(params.m_ProjectionWeights == nullptr)
1460  {
1461  throw InvalidArgumentException("AddLstmLayer: Projection Weights cannot be NULL");
1462  }
1463  layer->m_ProjectionParameters.m_ProjectionWeights =
1464  std::make_unique<ScopedCpuTensorHandle>(*(params.m_ProjectionWeights));
1465  if(params.m_ProjectionBias != nullptr)
1466  {
1467  layer->m_ProjectionParameters.m_ProjectionBias =
1468  std::make_unique<ScopedCpuTensorHandle>(*(params.m_ProjectionBias));
1469  }
1470  }
1471 
1472  //Lstm Peephole params
1473  if(descriptor.m_PeepholeEnabled)
1474  {
1475  if(params.m_CellToForgetWeights == nullptr)
1476  {
1477  throw InvalidArgumentException("AddLstmLayer: Cell To Forget Weights cannot be NULL");
1478  }
1479  if(params.m_CellToOutputWeights == nullptr)
1480  {
1481  throw InvalidArgumentException("AddLstmLayer: Cell To Output Weights cannot be NULL");
1482  }
1483  layer->m_PeepholeParameters.m_CellToForgetWeights =
1484  std::make_unique<ScopedCpuTensorHandle>(*(params.m_CellToForgetWeights));
1485  layer->m_PeepholeParameters.m_CellToOutputWeights =
1486  std::make_unique<ScopedCpuTensorHandle>(*(params.m_CellToOutputWeights));
1487  }
1488 
1489  //Lstm Layer Normalization params
1490  if(descriptor.m_LayerNormEnabled)
1491  {
1492  if(!descriptor.m_CifgEnabled)
1493  {
1494  if(params.m_InputLayerNormWeights == nullptr)
1495  {
1496  throw InvalidArgumentException("AddLstmLayer: Input layer normalization weights cannot be NULL");
1497  }
1498  layer->m_LayerNormParameters.m_InputLayerNormWeights =
1499  std::make_unique<ScopedCpuTensorHandle>(*(params.m_InputLayerNormWeights));
1500  }
1501 
1502  if(params.m_ForgetLayerNormWeights == nullptr)
1503  {
1504  throw InvalidArgumentException("AddLstmLayer: Forget layer normalization weights cannot be NULL");
1505  }
1506  if(params.m_CellLayerNormWeights == nullptr)
1507  {
1508  throw InvalidArgumentException("AddLstmLayer: Cell layer normalization weights cannot be NULL");
1509  }
1510  if(params.m_OutputLayerNormWeights == nullptr)
1511  {
1512  throw InvalidArgumentException("AddLstmLayer: Output layer normalization weights cannot be NULL");
1513  }
1514  layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
1515  std::make_unique<ScopedCpuTensorHandle>(*(params.m_ForgetLayerNormWeights));
1516  layer->m_LayerNormParameters.m_CellLayerNormWeights =
1517  std::make_unique<ScopedCpuTensorHandle>(*(params.m_CellLayerNormWeights));
1518  layer->m_LayerNormParameters.m_OutputLayerNormWeights =
1519  std::make_unique<ScopedCpuTensorHandle>(*(params.m_OutputLayerNormWeights));
1520  }
1521  return layer;
1522 }

◆ AddMaximumLayer()

IConnectableLayer * AddMaximumLayer ( const char *  name = nullptr)
overridevirtual

Add a Maximum layer to the network.

Parameters
name- Optional name for the layer. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1279 of file Network.cpp.

Referenced by Network::GetGuid().

1280 {
1281  return m_Graph->AddLayer<MaximumLayer>(name);
1282 }

◆ AddMeanLayer()

IConnectableLayer * AddMeanLayer ( const MeanDescriptor meanDescriptor,
const char *  name = nullptr 
)
overridevirtual

Add a Mean layer to the network.

Parameters
meanDescriptor- Parameters for the mean operation.
name- Optional name for the layer. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1534 of file Network.cpp.

Referenced by Network::GetGuid().

1535 {
1536  return m_Graph->AddLayer<MeanLayer>(meanDescriptor,name);
1537 }

◆ AddMergeLayer()

IConnectableLayer * AddMergeLayer ( const char *  name = nullptr)
overridevirtual

Adds a merge layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1580 of file Network.cpp.

Referenced by Network::GetGuid().

1581 {
1582  return m_Graph->AddLayer<MergeLayer>(name);
1583 }

◆ AddMergerLayer()

IConnectableLayer * AddMergerLayer ( const MergerDescriptor mergerDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a concat layer to the network.

Parameters
mergerDescriptor- MergerDescriptor (synonym for OriginsDescriptor) to configure the concatenation process. Number of Views must be equal to the number of inputs, and their order must match - e.g. first view corresponds to the first input, second view to the second input, etc....
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1289 of file Network.cpp.

References Network::AddConcatLayer().

Referenced by Network::GetGuid().

1291 {
1292  return AddConcatLayer(mergerDescriptor, name);
1293 }
IConnectableLayer * AddConcatLayer(const ConcatDescriptor &concatDescriptor, const char *name=nullptr) override
Adds a concatenation layer to the network.
Definition: Network.cpp:1111

◆ AddMinimumLayer()

IConnectableLayer * AddMinimumLayer ( const char *  name = nullptr)
overridevirtual

Add a Minimum layer to the network.

Parameters
name- Optional name for the layer. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1284 of file Network.cpp.

Referenced by Network::GetGuid().

1285 {
1286  return m_Graph->AddLayer<MinimumLayer>(name);
1287 }

◆ AddMultiplicationLayer()

IConnectableLayer * AddMultiplicationLayer ( const char *  name = nullptr)
overridevirtual

Adds a multiplication layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1305 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1306 {
1307  return m_Graph->AddLayer<MultiplicationLayer>(name);
1308 }

◆ AddNormalizationLayer()

IConnectableLayer * AddNormalizationLayer ( const NormalizationDescriptor normalizationDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a normalization layer to the network.

Parameters
normalizationDescriptor- NormalizationDescriptor to configure the normalization.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1255 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1258 {
1259  return m_Graph->AddLayer<NormalizationLayer>(normalizationDescriptor, name);
1260 }

◆ AddOutputLayer()

IConnectableLayer * AddOutputLayer ( LayerBindingId  id,
const char *  name = nullptr 
)
overridevirtual

Adds an output layer to the network.

Parameters
id- User generated id to uniquely identify a particular output. The same id needs to be specified when passing the outputs to the IRuntime::EnqueueWorkload() function.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1310 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1311 {
1312  return m_Graph->AddLayer<OutputLayer>(id, name);
1313 }

◆ AddPadLayer()

IConnectableLayer * AddPadLayer ( const PadDescriptor padDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a fully pad layer to the network.

Parameters
paddings- n by 2 tensor, where n is the rank of the input tensor, such that paddings[i,0] indicates the amount of padding to add in front of dimonsion i, and paddings[i,1] indicates the amount of padding to add after the end of dimension i
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1539 of file Network.cpp.

Referenced by Network::GetGuid().

1540 {
1541  return m_Graph->AddLayer<PadLayer>(padDescriptor,name);
1542 }

◆ AddPermuteLayer()

IConnectableLayer * AddPermuteLayer ( const PermuteDescriptor permuteDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a permute layer to the network.

Parameters
permuteDescriptor- PermuteDescriptor to configure the permute.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1231 of file Network.cpp.

Referenced by Network::GetGuid().

1233 {
1234  return m_Graph->AddLayer<PermuteLayer>(permuteDescriptor, name);
1235 }

◆ AddPooling2dLayer()

IConnectableLayer * AddPooling2dLayer ( const Pooling2dDescriptor pooling2dDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a pooling layer to the network.

Parameters
pooling2dDescriptor- Pooling2dDescriptor to configure the pooling.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1237 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1239 {
1240  return m_Graph->AddLayer<Pooling2dLayer>(pooling2dDescriptor, name);
1241 }

◆ AddPreluLayer()

IConnectableLayer * AddPreluLayer ( const char *  name = nullptr)
overridevirtual

Adds a PReLU layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1590 of file Network.cpp.

Referenced by Network::GetGuid().

1591 {
1592  return m_Graph->AddLayer<PreluLayer>(name);
1593 }

◆ AddQuantizedLstmLayer()

IConnectableLayer * AddQuantizedLstmLayer ( const QuantizedLstmInputParams params,
const char *  name = nullptr 
)
overridevirtual

Add a QuantizedLstm layer to the network.

Parameters
params- The weights and biases for the Quantized LSTM cell
name- Optional name for the layer
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1636 of file Network.cpp.

References QuantizedLstmInputParams::GetCellBias(), QuantizedLstmInputParams::GetForgetGateBias(), QuantizedLstmInputParams::GetInputGateBias(), QuantizedLstmInputParams::GetInputToCellWeights(), QuantizedLstmInputParams::GetInputToForgetWeights(), QuantizedLstmInputParams::GetInputToInputWeights(), QuantizedLstmInputParams::GetInputToOutputWeights(), QuantizedLstmInputParams::GetOutputGateBias(), QuantizedLstmInputParams::GetRecurrentToCellWeights(), QuantizedLstmInputParams::GetRecurrentToForgetWeights(), QuantizedLstmInputParams::GetRecurrentToInputWeights(), QuantizedLstmInputParams::GetRecurrentToOutputWeights(), QuantizedLstmParameters::m_InputToInputWeights, and QuantizedLstmLayer::m_QuantizedLstmParameters.

Referenced by armnn::BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1638 {
1639  const auto layer = m_Graph->AddLayer<QuantizedLstmLayer>(name);
1640 
1641  // InputToX weights
1642  layer->m_QuantizedLstmParameters.m_InputToInputWeights =
1643  std::make_unique<ScopedCpuTensorHandle>(params.GetInputToInputWeights());
1644  layer->m_QuantizedLstmParameters.m_InputToForgetWeights =
1645  std::make_unique<ScopedCpuTensorHandle>(params.GetInputToForgetWeights());
1646  layer->m_QuantizedLstmParameters.m_InputToCellWeights =
1647  std::make_unique<ScopedCpuTensorHandle>(params.GetInputToCellWeights());
1648  layer->m_QuantizedLstmParameters.m_InputToOutputWeights =
1649  std::make_unique<ScopedCpuTensorHandle>(params.GetInputToOutputWeights());
1650 
1651  // RecurrentToX weights
1652  layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights =
1653  std::make_unique<ScopedCpuTensorHandle>(params.GetRecurrentToInputWeights());
1654  layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights =
1655  std::make_unique<ScopedCpuTensorHandle>(params.GetRecurrentToForgetWeights());
1656  layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights =
1657  std::make_unique<ScopedCpuTensorHandle>(params.GetRecurrentToCellWeights());
1658  layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights =
1659  std::make_unique<ScopedCpuTensorHandle>(params.GetRecurrentToOutputWeights());
1660 
1661  // Bias
1662  layer->m_QuantizedLstmParameters.m_InputGateBias =
1663  std::make_unique<ScopedCpuTensorHandle>(params.GetInputGateBias());
1664  layer->m_QuantizedLstmParameters.m_ForgetGateBias =
1665  std::make_unique<ScopedCpuTensorHandle>(params.GetForgetGateBias());
1666  layer->m_QuantizedLstmParameters.m_CellBias =
1667  std::make_unique<ScopedCpuTensorHandle>(params.GetCellBias());
1668  layer->m_QuantizedLstmParameters.m_OutputGateBias =
1669  std::make_unique<ScopedCpuTensorHandle>(params.GetOutputGateBias());
1670 
1671  return layer;
1672 }

◆ AddQuantizeLayer()

IConnectableLayer * AddQuantizeLayer ( const char *  name = nullptr)
overridevirtual

Add a quantize layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1544 of file Network.cpp.

Referenced by Network::GetGuid().

1545 {
1546  return m_Graph->AddLayer<QuantizeLayer>(name);
1547 }

◆ AddReshapeLayer()

IConnectableLayer * AddReshapeLayer ( const ReshapeDescriptor reshapeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a reshape layer to the network.

Parameters
reshapeDescriptor- Parameters for the reshape operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1377 of file Network.cpp.

Referenced by Network::GetGuid().

1379 {
1380  return m_Graph->AddLayer<ReshapeLayer>(reshapeDescriptor, name);
1381 }

◆ AddResizeBilinearLayer()

IConnectableLayer * AddResizeBilinearLayer ( const ResizeBilinearDescriptor resizeDesc,
const char *  name = nullptr 
)
overridevirtual

Adds a resize bilinear layer to the network.

Parameters
resizeDesc- Parameters for the resize operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1332 of file Network.cpp.

References armnn::Bilinear, ResizeBilinearDescriptor::m_DataLayout, ResizeDescriptor::m_DataLayout, ResizeDescriptor::m_Method, ResizeBilinearDescriptor::m_TargetHeight, ResizeDescriptor::m_TargetHeight, ResizeBilinearDescriptor::m_TargetWidth, and ResizeDescriptor::m_TargetWidth.

Referenced by Network::GetGuid().

1334 {
1335  ResizeDescriptor resizeDescriptor;
1336  resizeDescriptor.m_Method = ResizeMethod::Bilinear;
1337  resizeDescriptor.m_DataLayout = descriptor.m_DataLayout;
1338  resizeDescriptor.m_TargetWidth = descriptor.m_TargetWidth;
1339  resizeDescriptor.m_TargetHeight = descriptor.m_TargetHeight;
1340 
1341  return m_Graph->AddLayer<ResizeLayer>(resizeDescriptor, name);
1342 }

◆ AddResizeLayer()

IConnectableLayer * AddResizeLayer ( const ResizeDescriptor resizeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a resize layer to the network.

Parameters
resizeDescriptor- Parameters for the resize operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1344 of file Network.cpp.

Referenced by Network::GetGuid().

1346 {
1347  return m_Graph->AddLayer<ResizeLayer>(resizeDescriptor, name);
1348 }

◆ AddRsqrtLayer()

IConnectableLayer * AddRsqrtLayer ( const char *  name = nullptr)
overridevirtual

Add Reciprocal of square root layer to the network.

Parameters
name- Optional name for the layer. @ return - Interface for configuring the layer.

Implements INetwork.

Definition at line 1570 of file Network.cpp.

References Network::AddElementwiseUnaryLayer(), and armnn::Rsqrt.

Referenced by Network::GetGuid().

1571 {
1572  return AddElementwiseUnaryLayer(ElementwiseUnaryDescriptor(UnaryOperation::Rsqrt), name);
1573 }
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr) override
Add an ElementwiseUnary layer to the network.
Definition: Network.cpp:1058

◆ AddSliceLayer()

IConnectableLayer * AddSliceLayer ( const SliceDescriptor sliceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a slice layer to the network.

Parameters
sliceDescriptor- SliceDescriptor to configure the slice operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1262 of file Network.cpp.

Referenced by Network::GetGuid().

1263 {
1264  return m_Graph->AddLayer<SliceLayer>(sliceDescriptor, name);
1265 }

◆ AddSoftmaxLayer()

IConnectableLayer * AddSoftmaxLayer ( const SoftmaxDescriptor softmaxDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a softmax layer to the network.

If the data type is QAsymm8, then the output quantization parameters must have a scale of 1/256 and an offset of 0

Parameters
softmaxDescriptor- SoftmaxDescriptor to configure the softmax.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1267 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1269 {
1270  return m_Graph->AddLayer<SoftmaxLayer>(softmaxDescriptor, name);
1271 }

◆ AddSpaceToBatchNdLayer()

IConnectableLayer * AddSpaceToBatchNdLayer ( const SpaceToBatchNdDescriptor spaceToBatchNdDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a space to batch layer to the network.

Parameters
spaceToBatchNdDescriptor- Parameters for the space to batch operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1383 of file Network.cpp.

Referenced by Network::GetGuid().

1385 {
1386  return m_Graph->AddLayer<SpaceToBatchNdLayer>(spaceToBatchNdDescriptor, name);
1387 }

◆ AddSpaceToDepthLayer()

IConnectableLayer * AddSpaceToDepthLayer ( const SpaceToDepthDescriptor spaceToDepthDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a space to depth layer to the network.

Parameters
spaceToDepthDescriptor- Parameters for the space to depth operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1389 of file Network.cpp.

Referenced by Network::GetGuid().

1391 {
1392  return m_Graph->AddLayer<SpaceToDepthLayer>(spaceToDepthDescriptor, name);
1393 }

◆ AddSplitterLayer()

IConnectableLayer * AddSplitterLayer ( const ViewsDescriptor splitterDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a splitter layer to the network.

Parameters
splitterDescriptor- ViewsDescriptor to configure the splitting process. Number of Views must be equal to the number of outputs, and their order must match - e.g. first view corresponds to the first output, second view to the second output, etc....
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1273 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1275 {
1276  return m_Graph->AddLayer<SplitterLayer>(splitterDescriptor, name);
1277 }

◆ AddStackLayer()

IConnectableLayer * AddStackLayer ( const StackDescriptor descriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a stack layer to the network.

Parameters
descriptor- Description of the stack layer.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1623 of file Network.cpp.

Referenced by Network::GetGuid().

1625 {
1626  return m_Graph->AddLayer<StackLayer>(stackDescriptor, name);
1627 }

◆ AddStandInLayer()

IConnectableLayer * AddStandInLayer ( const StandInDescriptor descriptor,
const char *  name = nullptr 
)
overridevirtual

Add a stand-in layer for a type unknown to the Arm NN framework.

Note: Due to the nature of this layer, no validation can be performed by the framework. Furthermore, Any model containing this layer cannot make use of dynamic tensors since the tensor sizes cannot be inferred. - Descriptor for the StandIn layer.

Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1630 of file Network.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGuid().

1632 {
1633  return m_Graph->AddLayer<StandInLayer>(desc, name);
1634 }

◆ AddStridedSliceLayer()

IConnectableLayer * AddStridedSliceLayer ( const StridedSliceDescriptor stridedSliceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a strided slice layer to the network.

Parameters
StridedSliceDescriptor- Parameters for the strided slice operation.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1554 of file Network.cpp.

Referenced by Network::GetGuid().

1556 {
1557  return m_Graph->AddLayer<StridedSliceLayer>(stridedSliceDescriptor, name);
1558 }

◆ AddSubtractionLayer()

IConnectableLayer * AddSubtractionLayer ( const char *  name = nullptr)
overridevirtual

Adds a subtraction layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1529 of file Network.cpp.

Referenced by Network::GetGuid().

1530 {
1531  return m_Graph->AddLayer<SubtractionLayer>(name);
1532 }

◆ AddSwitchLayer()

IConnectableLayer * AddSwitchLayer ( const char *  name = nullptr)
overridevirtual

Adds a switch layer to the network.

Parameters
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1585 of file Network.cpp.

Referenced by Network::GetGuid().

1586 {
1587  return m_Graph->AddLayer<SwitchLayer>(name);
1588 }

◆ AddTransposeConvolution2dLayer()

IConnectableLayer * AddTransposeConvolution2dLayer ( const TransposeConvolution2dDescriptor descriptor,
const ConstTensor weights,
const Optional< ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Adds a 2D transpose convolution layer to the network.

Parameters
descriptor- Description of the 2D transpose convolution layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1595 of file Network.cpp.

References OptionalBase::has_value(), TransposeConvolution2dDescriptor::m_BiasEnabled, TransposeConvolution2dLayer::m_Weight, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by Network::GetGuid().

1599 {
1600  if (descriptor.m_BiasEnabled && !biases.has_value())
1601  {
1602  throw InvalidArgumentException("AddTransposeConvolution2dLayer: Biases cannot be empty");
1603  }
1604 
1605  const auto layer = m_Graph->AddLayer<TransposeConvolution2dLayer>(descriptor, name);
1606 
1607  layer->m_Weight = std::make_unique<ScopedCpuTensorHandle>(weights);
1608 
1609  if (descriptor.m_BiasEnabled)
1610  {
1611  layer->m_Bias = std::make_unique<ScopedCpuTensorHandle>(biases.value());
1612  }
1613 
1614  return layer;
1615 }

◆ AddTransposeLayer()

IConnectableLayer * AddTransposeLayer ( const TransposeDescriptor transposeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Adds a transpose layer to the network.

Parameters
transposeDescriptor- TransposeDescriptor to configure the transpose.
name- Optional name for the layer.
Returns
- Interface for configuring the layer.

Implements INetwork.

Definition at line 1617 of file Network.cpp.

Referenced by Network::GetGuid().

1619 {
1620  return m_Graph->AddLayer<TransposeLayer>(transposeDescriptor, name);
1621 }

◆ GetGraph()

const Graph& GetGraph ( ) const
inline

◆ GetGuid()

profiling::ProfilingGuid GetGuid ( ) const
inlinefinalvirtual

Implements INetwork.

Definition at line 38 of file Network.hpp.

References Network::Accept(), Network::AddAbsLayer(), Network::AddActivationLayer(), Network::AddAdditionLayer(), Network::AddArgMinMaxLayer(), Network::AddBatchNormalizationLayer(), Network::AddBatchToSpaceNdLayer(), Network::AddComparisonLayer(), Network::AddConcatLayer(), Network::AddConstantLayer(), Network::AddConvolution2dLayer(), Network::AddDepthToSpaceLayer(), Network::AddDepthwiseConvolution2dLayer(), Network::AddDequantizeLayer(), Network::AddDetectionPostProcessLayer(), Network::AddDivisionLayer(), Network::AddElementwiseUnaryLayer(), Network::AddEqualLayer(), Network::AddFloorLayer(), Network::AddFullyConnectedLayer(), Network::AddGatherLayer(), Network::AddGreaterLayer(), Network::AddInputLayer(), Network::AddInstanceNormalizationLayer(), Network::AddL2NormalizationLayer(), Network::AddLogSoftmaxLayer(), Network::AddLstmLayer(), Network::AddMaximumLayer(), Network::AddMeanLayer(), Network::AddMergeLayer(), Network::AddMergerLayer(), Network::AddMinimumLayer(), Network::AddMultiplicationLayer(), Network::AddNormalizationLayer(), Network::AddOutputLayer(), Network::AddPadLayer(), Network::AddPermuteLayer(), Network::AddPooling2dLayer(), Network::AddPreluLayer(), Network::AddQuantizedLstmLayer(), Network::AddQuantizeLayer(), Network::AddReshapeLayer(), Network::AddResizeBilinearLayer(), Network::AddResizeLayer(), Network::AddRsqrtLayer(), Network::AddSliceLayer(), Network::AddSoftmaxLayer(), Network::AddSpaceToBatchNdLayer(), Network::AddSpaceToDepthLayer(), Network::AddSplitterLayer(), Network::AddStackLayer(), Network::AddStandInLayer(), Network::AddStridedSliceLayer(), Network::AddSubtractionLayer(), Network::AddSwitchLayer(), Network::AddTransposeConvolution2dLayer(), Network::AddTransposeLayer(), anchors(), and ARMNN_DEPRECATED_MSG.

38 { return m_Guid; };

◆ PrintGraph()

Status PrintGraph ( )
overridevirtual

Implements INetwork.

Definition at line 1035 of file Network.cpp.

References armnn::Success.

Referenced by BOOST_AUTO_TEST_CASE(), and Network::GetGraph().

1036 {
1037  m_Graph->Print();
1038  return Status::Success;
1039 }

The documentation for this class was generated from the following files: