ArmNN
 24.02
NetworkImpl Class Reference

Private implementation of INetwork. More...

#include <Network.hpp>

Public Member Functions

 NetworkImpl (const NetworkOptions &networkOptions={})
 
 ~NetworkImpl ()
 
const GraphGetGraph () const
 
Status PrintGraph ()
 
IConnectableLayerAddInputLayer (LayerBindingId id, const char *name=nullptr)
 
IConnectableLayerAddActivationLayer (const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
 
IConnectableLayerAddAdditionLayer (const char *name=nullptr)
 
IConnectableLayerAddArgMinMaxLayer (const ArgMinMaxDescriptor &desc, const char *name=nullptr)
 
IConnectableLayerAddBatchMatMulLayer (const BatchMatMulDescriptor &desc, const char *name=nullptr)
 
IConnectableLayerAddBatchNormalizationLayer (const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr)
 
IConnectableLayerAddBatchToSpaceNdLayer (const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)
 
IConnectableLayerAddBroadcastToLayer (const BroadcastToDescriptor &descriptor, const char *name=nullptr)
 
IConnectableLayerAddCastLayer (const char *name=nullptr)
 
IConnectableLayerAddChannelShuffleLayer (const ChannelShuffleDescriptor &channelShuffleDescriptor, const char *name=nullptr)
 
IConnectableLayerAddComparisonLayer (const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr)
 
IConnectableLayerAddConcatLayer (const ConcatDescriptor &concatDescriptor, const char *name=nullptr)
 
IConnectableLayerAddConvolution2dLayer (const Convolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
 
IConnectableLayerAddConvolution3dLayer (const Convolution3dDescriptor &convolution3dDescriptor, const char *name=nullptr)
 
IConnectableLayerAddConstantLayer (const ConstTensor &input, const char *name=nullptr)
 
IConnectableLayerAddDepthToSpaceLayer (const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)
 
IConnectableLayerAddDepthwiseConvolution2dLayer (const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
 
IConnectableLayerAddDequantizeLayer (const char *name=nullptr)
 
IConnectableLayerAddDetectionPostProcessLayer (const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)
 
IConnectableLayerAddDivisionLayer (const char *name=nullptr)
 
IConnectableLayerAddElementwiseBinaryLayer (const ElementwiseBinaryDescriptor &elementwiseBinaryDescriptor, const char *name=nullptr)
 
IConnectableLayerAddElementwiseUnaryLayer (const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
 
IConnectableLayerAddMergeLayer (const char *name=nullptr)
 
IConnectableLayerAddFillLayer (const FillDescriptor &fillDescriptor, const char *name=nullptr)
 
IConnectableLayerAddFloorLayer (const char *name=nullptr)
 
IConnectableLayerAddFullyConnectedLayer (const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)
 
IConnectableLayerAddFusedLayer (const FusedDescriptor &fusedDescriptor, const char *name=nullptr)
 
IConnectableLayerAddGatherLayer (const GatherDescriptor &gatherDescriptor, const char *name=nullptr)
 
IConnectableLayerAddGatherNdLayer (const char *name=nullptr)
 
IConnectableLayerAddInstanceNormalizationLayer (const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
 
IConnectableLayerAddL2NormalizationLayer (const L2NormalizationDescriptor &desc, const char *name=nullptr)
 
IConnectableLayerAddLogSoftmaxLayer (const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)
 
IConnectableLayerAddLogicalBinaryLayer (const LogicalBinaryDescriptor &logicalBinaryDescriptor, const char *name=nullptr)
 
IConnectableLayerAddLstmLayer (const LstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)
 
IConnectableLayerAddMaximumLayer (const char *name=nullptr)
 
IConnectableLayerAddMeanLayer (const MeanDescriptor &meanDescriptor, const char *name=nullptr)
 
IConnectableLayerAddMinimumLayer (const char *name=nullptr)
 
IConnectableLayerAddMultiplicationLayer (const char *name=nullptr)
 
IConnectableLayerAddNormalizationLayer (const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
 
IConnectableLayerAddOutputLayer (LayerBindingId id, const char *name=nullptr)
 
IConnectableLayerAddPadLayer (const PadDescriptor &padDescriptor, const char *name=nullptr)
 
IConnectableLayerAddPermuteLayer (const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
 
IConnectableLayerAddPooling2dLayer (const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)
 
IConnectableLayerAddPooling3dLayer (const Pooling3dDescriptor &pooling3dDescriptor, const char *name=nullptr)
 
IConnectableLayerAddPrecompiledLayer (const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
 
IConnectableLayerAddPreluLayer (const char *name=nullptr)
 
IConnectableLayerAddQuantizeLayer (const char *name=nullptr)
 
IConnectableLayerAddQLstmLayer (const QLstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)
 
IConnectableLayerAddQuantizedLstmLayer (const QuantizedLstmInputParams &params, const char *name=nullptr)
 
IConnectableLayerAddRankLayer (const char *name=nullptr)
 
IConnectableLayerAddReduceLayer (const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)
 
IConnectableLayerAddResizeLayer (const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)
 
IConnectableLayerAddReshapeLayer (const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
 
IConnectableLayerAddReverseV2Layer (const char *name=nullptr)
 
IConnectableLayerAddShapeLayer (const char *name=nullptr)
 
IConnectableLayerAddSliceLayer (const SliceDescriptor &sliceDescriptor, const char *name=nullptr)
 
IConnectableLayerAddSoftmaxLayer (const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
 
IConnectableLayerAddSplitterLayer (const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
 
IConnectableLayerAddSpaceToBatchNdLayer (const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)
 
IConnectableLayerAddSpaceToDepthLayer (const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)
 
IConnectableLayerAddStackLayer (const StackDescriptor &stackDescriptor, const char *name=nullptr)
 
IConnectableLayerAddStandInLayer (const StandInDescriptor &descriptor, const char *name=nullptr)
 
IConnectableLayerAddStridedSliceLayer (const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)
 
IConnectableLayerAddSubtractionLayer (const char *name=nullptr)
 
IConnectableLayerAddSwitchLayer (const char *name=nullptr)
 
IConnectableLayerAddTileLayer (const TileDescriptor &tileDescriptor, const char *name=nullptr)
 
IConnectableLayerAddTransposeConvolution2dLayer (const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)
 
IConnectableLayerAddTransposeLayer (const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)
 
IConnectableLayerAddUnidirectionalSequenceLstmLayer (const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)
 
IConnectableLayerAddConvertFp16ToFp32Layer (const char *name=nullptr)
 
IConnectableLayerAddConvertFp32ToFp16Layer (const char *name=nullptr)
 
void ExecuteStrategy (IStrategy &strategy) const
 

Detailed Description

Private implementation of INetwork.

Definition at line 32 of file Network.hpp.

Constructor & Destructor Documentation

◆ NetworkImpl()

NetworkImpl ( const NetworkOptions networkOptions = {})

Definition at line 2173 of file Network.cpp.

2174 : m_NetworkOptions(networkOptions),
2175  m_Graph(std::make_unique<Graph>(GetShapeInferenceMethod(), GetAllowExpandedDims()))
2176 {}

◆ ~NetworkImpl()

Definition at line 2178 of file Network.cpp.

2179 {
2180 }

Member Function Documentation

◆ AddActivationLayer()

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

Definition at line 2314 of file Network.cpp.

2316 {
2317  return m_Graph->AddLayer<ActivationLayer>(activationDescriptor, name);
2318 }

◆ AddAdditionLayer()

IConnectableLayer * AddAdditionLayer ( const char *  name = nullptr)

Definition at line 2360 of file Network.cpp.

2361 {
2362  return m_Graph->AddLayer<AdditionLayer>(name);
2363 }

◆ AddArgMinMaxLayer()

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

Definition at line 2320 of file Network.cpp.

2322 {
2323  return m_Graph->AddLayer<ArgMinMaxLayer>(argMinMaxDescriptor, name);
2324 }

◆ AddBatchMatMulLayer()

IConnectableLayer * AddBatchMatMulLayer ( const BatchMatMulDescriptor desc,
const char *  name = nullptr 
)

Definition at line 3035 of file Network.cpp.

3036 {
3037  return m_Graph->AddLayer<BatchMatMulLayer>(desc, name);
3038 }

◆ AddBatchNormalizationLayer()

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

Definition at line 2375 of file Network.cpp.

2381 {
2382  const auto layer = m_Graph->AddLayer<BatchNormalizationLayer>(desc, name);
2383 
2384  layer->m_Mean = std::make_shared<ScopedTensorHandle>(mean);
2385  layer->m_Variance = std::make_shared<ScopedTensorHandle>(variance);
2386  layer->m_Beta = std::make_shared<ScopedTensorHandle>(beta);
2387  layer->m_Gamma = std::make_shared<ScopedTensorHandle>(gamma);
2388 
2389  return layer;
2390 }

References BatchNormalizationLayer::m_Mean.

◆ AddBatchToSpaceNdLayer()

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

Definition at line 2193 of file Network.cpp.

2195 {
2196  return m_Graph->AddLayer<BatchToSpaceNdLayer>(batchToSpaceNdDescriptor, name);
2197 }

◆ AddBroadcastToLayer()

IConnectableLayer * AddBroadcastToLayer ( const BroadcastToDescriptor descriptor,
const char *  name = nullptr 
)

Definition at line 3083 of file Network.cpp.

3084 {
3085  return m_Graph->AddLayer<BroadcastToLayer>(desc, name);
3086 }

◆ AddCastLayer()

IConnectableLayer * AddCastLayer ( const char *  name = nullptr)

Definition at line 2199 of file Network.cpp.

2200 {
2201  return m_Graph->AddLayer<CastLayer>(name);
2202 }

◆ AddChannelShuffleLayer()

IConnectableLayer * AddChannelShuffleLayer ( const ChannelShuffleDescriptor channelShuffleDescriptor,
const char *  name = nullptr 
)

Definition at line 2203 of file Network.cpp.

2205 {
2206  return m_Graph->AddLayer<ChannelShuffleLayer>(channelShuffleDescriptor, name);
2207 }

◆ AddComparisonLayer()

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

Definition at line 2209 of file Network.cpp.

2211 {
2212  return m_Graph->AddLayer<ComparisonLayer>(comparisonDescriptor, name);
2213 }

◆ AddConcatLayer()

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

Definition at line 2245 of file Network.cpp.

2247 {
2248  return m_Graph->AddLayer<ConcatLayer>(concatDescriptor, name);
2249 }

◆ AddConstantLayer()

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

Definition at line 2431 of file Network.cpp.

2432 {
2433  auto layer = m_Graph->AddLayer<ConstantLayer>(name);
2434 
2435  layer->m_LayerOutput = std::make_shared<ScopedTensorHandle>(input);
2436 
2437  return layer;
2438 }

References ConstantLayer::m_LayerOutput.

◆ AddConvertFp16ToFp32Layer()

IConnectableLayer * AddConvertFp16ToFp32Layer ( const char *  name = nullptr)

Definition at line 2257 of file Network.cpp.

2258 {
2259  return m_Graph->AddLayer<ConvertFp16ToFp32Layer>(name);
2260 }

◆ AddConvertFp32ToFp16Layer()

IConnectableLayer * AddConvertFp32ToFp16Layer ( const char *  name = nullptr)

Definition at line 2262 of file Network.cpp.

2263 {
2264  return m_Graph->AddLayer<ConvertFp32ToFp16Layer>(name);
2265 }

◆ AddConvolution2dLayer()

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

Definition at line 2251 of file Network.cpp.

2253 {
2254  return m_Graph->AddLayer<Convolution2dLayer>(convolution2dDescriptor, name);
2255 }

◆ AddConvolution3dLayer()

IConnectableLayer * AddConvolution3dLayer ( const Convolution3dDescriptor convolution3dDescriptor,
const char *  name = nullptr 
)

Definition at line 2267 of file Network.cpp.

2269 {
2270  return m_Graph->AddLayer<Convolution3dLayer>(convolution3dDescriptor, name);
2271 }

◆ AddDepthToSpaceLayer()

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

Definition at line 2273 of file Network.cpp.

2275 {
2276  return m_Graph->AddLayer<DepthToSpaceLayer>(depthToSpaceDescriptor, name);
2277 }

◆ AddDepthwiseConvolution2dLayer()

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

Definition at line 2279 of file Network.cpp.

2282 {
2283  return m_Graph->AddLayer<DepthwiseConvolution2dLayer>(convolution2dDescriptor, name);
2284 }

◆ AddDequantizeLayer()

IConnectableLayer * AddDequantizeLayer ( const char *  name = nullptr)

Definition at line 2629 of file Network.cpp.

2630 {
2631  return m_Graph->AddLayer<DequantizeLayer>(name);
2632 }

◆ AddDetectionPostProcessLayer()

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

Definition at line 2286 of file Network.cpp.

2288 {
2289  const auto layer = m_Graph->AddLayer<DetectionPostProcessLayer>(descriptor, name);
2290 
2291  layer->m_Anchors = std::make_shared<ScopedTensorHandle>(anchors);
2292 
2293  return layer;
2294 }

References DetectionPostProcessLayer::m_Anchors.

◆ AddDivisionLayer()

IConnectableLayer * AddDivisionLayer ( const char *  name = nullptr)

Definition at line 2604 of file Network.cpp.

2605 {
2606  return m_Graph->AddLayer<DivisionLayer>(name);
2607 }

◆ AddElementwiseBinaryLayer()

IConnectableLayer * AddElementwiseBinaryLayer ( const ElementwiseBinaryDescriptor elementwiseBinaryDescriptor,
const char *  name = nullptr 
)

Definition at line 2215 of file Network.cpp.

2217 {
2218  return m_Graph->AddLayer<ElementwiseBinaryLayer>(elementwiseBinaryDesc, name);
2219 }

◆ AddElementwiseUnaryLayer()

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

Definition at line 2221 of file Network.cpp.

2223 {
2224  return m_Graph->AddLayer<ElementwiseUnaryLayer>(elementwiseUnaryDescriptor, name);
2225 }

◆ AddFillLayer()

IConnectableLayer * AddFillLayer ( const FillDescriptor fillDescriptor,
const char *  name = nullptr 
)

Definition at line 2227 of file Network.cpp.

2229 {
2230  return m_Graph->AddLayer<FillLayer>(fillDescriptor, name);
2231 }

◆ AddFloorLayer()

IConnectableLayer * AddFloorLayer ( const char *  name = nullptr)

Definition at line 2458 of file Network.cpp.

2459 {
2460  return m_Graph->AddLayer<FloorLayer>(name);
2461 }

◆ AddFullyConnectedLayer()

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

Definition at line 2233 of file Network.cpp.

2235 {
2236  return m_Graph->AddLayer<FullyConnectedLayer>(fullyConnectedDescriptor, name);
2237 }

◆ AddFusedLayer()

IConnectableLayer * AddFusedLayer ( const FusedDescriptor fusedDescriptor,
const char *  name = nullptr 
)

Definition at line 2239 of file Network.cpp.

2241 {
2242  return m_Graph->AddLayer<FusedLayer>(fusedDescriptor, name);
2243 }

◆ AddGatherLayer()

IConnectableLayer * AddGatherLayer ( const GatherDescriptor gatherDescriptor,
const char *  name = nullptr 
)

Definition at line 2640 of file Network.cpp.

2642 {
2643  return m_Graph->AddLayer<GatherLayer>(gatherDescriptor, name);
2644 }

◆ AddGatherNdLayer()

IConnectableLayer * AddGatherNdLayer ( const char *  name = nullptr)

Definition at line 2646 of file Network.cpp.

2647 {
2648  return m_Graph->AddLayer<GatherNdLayer>(name);
2649 }

◆ AddInputLayer()

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

Definition at line 2188 of file Network.cpp.

2189 {
2190  return m_Graph->AddLayer<InputLayer>(id, name);
2191 }

◆ AddInstanceNormalizationLayer()

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

Definition at line 2413 of file Network.cpp.

2415 {
2416  return m_Graph->AddLayer<InstanceNormalizationLayer>(desc, name);
2417 }

◆ AddL2NormalizationLayer()

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

Definition at line 2419 of file Network.cpp.

2421 {
2422  return m_Graph->AddLayer<L2NormalizationLayer>(desc, name);
2423 }

◆ AddLogicalBinaryLayer()

IConnectableLayer * AddLogicalBinaryLayer ( const LogicalBinaryDescriptor logicalBinaryDescriptor,
const char *  name = nullptr 
)

Definition at line 2887 of file Network.cpp.

2889 {
2890  return m_Graph->AddLayer<LogicalBinaryLayer>(logicalBinaryDescriptor, name);
2891 }

◆ AddLogSoftmaxLayer()

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

Definition at line 2425 of file Network.cpp.

2427 {
2428  return m_Graph->AddLayer<LogSoftmaxLayer>(desc, name);
2429 }

◆ AddLstmLayer()

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

Definition at line 2463 of file Network.cpp.

2466 {
2467  const auto layer = m_Graph->AddLayer<LstmLayer>(descriptor, name);
2468 
2469  //Lstm Basic Parameters
2470  layer->m_BasicParameters.m_InputToForgetWeights =
2471  std::make_shared<ScopedTensorHandle>(*(params.m_InputToForgetWeights));
2472  layer->m_BasicParameters.m_InputToCellWeights =
2473  std::make_shared<ScopedTensorHandle>(*(params.m_InputToCellWeights));
2474  layer->m_BasicParameters.m_InputToOutputWeights =
2475  std::make_shared<ScopedTensorHandle>(*(params.m_InputToOutputWeights));
2476  layer->m_BasicParameters.m_RecurrentToForgetWeights =
2477  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToForgetWeights));
2478  layer->m_BasicParameters.m_RecurrentToCellWeights =
2479  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToCellWeights));
2480  layer->m_BasicParameters.m_RecurrentToOutputWeights =
2481  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToOutputWeights));
2482  layer->m_BasicParameters.m_ForgetGateBias =
2483  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetGateBias));
2484  layer->m_BasicParameters.m_CellBias =
2485  std::make_shared<ScopedTensorHandle>(*(params.m_CellBias));
2486  layer->m_BasicParameters.m_OutputGateBias =
2487  std::make_shared<ScopedTensorHandle>(*(params.m_OutputGateBias));
2488 
2489  //Lstm Cifg parameters
2490  if(!descriptor.m_CifgEnabled)
2491  {
2492  if(params.m_InputToInputWeights == nullptr)
2493  {
2494  throw InvalidArgumentException("AddLstmLayer: Input To Input Weights cannot be NULL "
2495  "when CIFG is disabled.");
2496  }
2497  if(params.m_RecurrentToInputWeights == nullptr)
2498  {
2499  throw InvalidArgumentException(
2500  "AddLstmLayer: Recurrent To Input Weights cannot be NULL "
2501  "when CIFG is disabled.");
2502  }
2503  if(params.m_InputGateBias == nullptr)
2504  {
2505  throw InvalidArgumentException("AddLstmLayer: Input Gate Bias cannot be NULL "
2506  "when CIFG is disabled.");
2507  }
2508  layer->m_CifgParameters.m_InputToInputWeights =
2509  std::make_shared<ScopedTensorHandle>(*(params.m_InputToInputWeights));
2510  layer->m_CifgParameters.m_RecurrentToInputWeights =
2511  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToInputWeights));
2512  layer->m_CifgParameters.m_InputGateBias =
2513  std::make_shared<ScopedTensorHandle>(*(params.m_InputGateBias));
2514  }
2515 
2516  //Lstm projection parameters
2517  if(descriptor.m_ProjectionEnabled)
2518  {
2519  if(params.m_ProjectionWeights == nullptr)
2520  {
2521  throw InvalidArgumentException("AddLstmLayer: Projection Weights cannot be NULL "
2522  "when projection is enabled.");
2523  }
2524  layer->m_ProjectionParameters.m_ProjectionWeights =
2525  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionWeights));
2526  if(params.m_ProjectionBias != nullptr)
2527  {
2528  layer->m_ProjectionParameters.m_ProjectionBias =
2529  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionBias));
2530  }
2531  }
2532 
2533  //Lstm Peephole params
2534  if(descriptor.m_PeepholeEnabled)
2535  {
2536  if(!descriptor.m_CifgEnabled)
2537  {
2538  if(params.m_CellToInputWeights == nullptr)
2539  {
2540  throw InvalidArgumentException("AddLstmLayer: Cell To Input Weights cannot be NULL "
2541  "when Peephole is enabled and CIFG disabled.");
2542  }
2543 
2544  layer->m_PeepholeParameters.m_CellToInputWeights =
2545  std::make_shared<ScopedTensorHandle>(*(params.m_CellToInputWeights));
2546  }
2547 
2548  if(params.m_CellToForgetWeights == nullptr)
2549  {
2550  throw InvalidArgumentException("AddLstmLayer: Cell To Forget Weights cannot be NULL "
2551  "when Peephole is enabled.");
2552  }
2553  if(params.m_CellToOutputWeights == nullptr)
2554  {
2555  throw InvalidArgumentException("AddLstmLayer: Cell To Output Weights cannot be NULL "
2556  "when Peephole is enabled.");
2557  }
2558 
2559  layer->m_PeepholeParameters.m_CellToForgetWeights =
2560  std::make_shared<ScopedTensorHandle>(*(params.m_CellToForgetWeights));
2561  layer->m_PeepholeParameters.m_CellToOutputWeights =
2562  std::make_shared<ScopedTensorHandle>(*(params.m_CellToOutputWeights));
2563  }
2564 
2565  //Lstm Layer Normalization params
2566  if(descriptor.m_LayerNormEnabled)
2567  {
2568  if(!descriptor.m_CifgEnabled)
2569  {
2570  if(params.m_InputLayerNormWeights == nullptr)
2571  {
2572  throw InvalidArgumentException("AddLstmLayer: Input layer normalization weights cannot be NULL "
2573  "when layer normalization is enabled and CIFG disabled.");
2574  }
2575  layer->m_LayerNormParameters.m_InputLayerNormWeights =
2576  std::make_shared<ScopedTensorHandle>(*(params.m_InputLayerNormWeights));
2577  }
2578 
2579  if(params.m_ForgetLayerNormWeights == nullptr)
2580  {
2581  throw InvalidArgumentException("AddLstmLayer: Forget layer normalization weights cannot be NULL "
2582  "when layer normalization is enabled.");
2583  }
2584  if(params.m_CellLayerNormWeights == nullptr)
2585  {
2586  throw InvalidArgumentException("AddLstmLayer: Cell layer normalization weights cannot be NULL "
2587  "when layer normalization is enabled.");
2588  }
2589  if(params.m_OutputLayerNormWeights == nullptr)
2590  {
2591  throw InvalidArgumentException("AddLstmLayer: Output layer normalization weights cannot be NULL "
2592  "when layer normalization is enabled.");
2593  }
2594  layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2595  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetLayerNormWeights));
2596  layer->m_LayerNormParameters.m_CellLayerNormWeights =
2597  std::make_shared<ScopedTensorHandle>(*(params.m_CellLayerNormWeights));
2598  layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2599  std::make_shared<ScopedTensorHandle>(*(params.m_OutputLayerNormWeights));
2600  }
2601  return layer;
2602 }

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.

◆ AddMaximumLayer()

IConnectableLayer * AddMaximumLayer ( const char *  name = nullptr)

Definition at line 2350 of file Network.cpp.

2351 {
2352  return m_Graph->AddLayer<MaximumLayer>(name);
2353 }

◆ AddMeanLayer()

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

Definition at line 2614 of file Network.cpp.

2615 {
2616  return m_Graph->AddLayer<MeanLayer>(meanDescriptor,name);
2617 }

◆ AddMergeLayer()

IConnectableLayer * AddMergeLayer ( const char *  name = nullptr)

Definition at line 2651 of file Network.cpp.

2652 {
2653  return m_Graph->AddLayer<MergeLayer>(name);
2654 }

◆ AddMinimumLayer()

IConnectableLayer * AddMinimumLayer ( const char *  name = nullptr)

Definition at line 2355 of file Network.cpp.

2356 {
2357  return m_Graph->AddLayer<MinimumLayer>(name);
2358 }

◆ AddMultiplicationLayer()

IConnectableLayer * AddMultiplicationLayer ( const char *  name = nullptr)

Definition at line 2365 of file Network.cpp.

2366 {
2367  return m_Graph->AddLayer<MultiplicationLayer>(name);
2368 }

◆ AddNormalizationLayer()

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

Definition at line 2326 of file Network.cpp.

2329 {
2330  return m_Graph->AddLayer<NormalizationLayer>(normalizationDescriptor, name);
2331 }

◆ AddOutputLayer()

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

Definition at line 2370 of file Network.cpp.

2371 {
2372  return m_Graph->AddLayer<OutputLayer>(id, name);
2373 }

◆ AddPadLayer()

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

Definition at line 2619 of file Network.cpp.

2620 {
2621  return m_Graph->AddLayer<PadLayer>(padDescriptor,name);
2622 }

◆ AddPermuteLayer()

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

Definition at line 2296 of file Network.cpp.

2298 {
2299  return m_Graph->AddLayer<PermuteLayer>(permuteDescriptor, name);
2300 }

◆ AddPooling2dLayer()

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

Definition at line 2302 of file Network.cpp.

2304 {
2305  return m_Graph->AddLayer<Pooling2dLayer>(pooling2dDescriptor, name);
2306 }

◆ AddPooling3dLayer()

IConnectableLayer * AddPooling3dLayer ( const Pooling3dDescriptor pooling3dDescriptor,
const char *  name = nullptr 
)

Definition at line 2308 of file Network.cpp.

2310 {
2311  return m_Graph->AddLayer<Pooling3dLayer>(pooling3dDescriptor, name);
2312 }

◆ AddPrecompiledLayer()

IConnectableLayer * AddPrecompiledLayer ( const PreCompiledDescriptor preCompiledDescriptor,
CompiledBlobPtr  compiledBlobPtr,
const Optional< BackendId > &  backend,
const char *  name = nullptr 
)

Definition at line 3050 of file Network.cpp.

3054 {
3055  // Method use is for backend users.
3056  PreCompiledLayer* layer;
3057  if (name)
3058  {
3059  layer = m_Graph->AddLayer<PreCompiledLayer>(preCompiledDescriptor, name);
3060  }
3061  else
3062  {
3063  layer = m_Graph->AddLayer<PreCompiledLayer>(preCompiledDescriptor, "pre-compiled");
3064  }
3065 
3066  // Assign the pre-compiled object to layer
3067  // Pass only one compiled network, Arm NN does not handle multiple
3068  // pre-compiled objects in a single pre-compiled layer currently
3069  layer->SetPreCompiledObject(std::move(compiledBlobPtr));
3070 
3071  if (backend.has_value())
3072  {
3073  layer->SetBackendId(backend.value());
3074  }
3075  else if (layer->GetBackendHint().has_value())
3076  {
3077  layer->SetBackendId(layer->GetBackendHint().value());
3078  }
3079 
3080  return layer;
3081 }

References Layer::GetBackendHint(), OptionalBase::has_value(), Layer::SetBackendId(), PreCompiledLayer::SetPreCompiledObject(), and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

◆ AddPreluLayer()

IConnectableLayer * AddPreluLayer ( const char *  name = nullptr)

Definition at line 2661 of file Network.cpp.

2662 {
2663  return m_Graph->AddLayer<PreluLayer>(name);
2664 }

◆ AddQLstmLayer()

IConnectableLayer * AddQLstmLayer ( const QLstmDescriptor descriptor,
const LstmInputParams params,
const char *  name = nullptr 
)

Definition at line 2745 of file Network.cpp.

2748 {
2749  const auto layer = m_Graph->AddLayer<QLstmLayer>(descriptor, name);
2750 
2751  // QLstm Basic Parameters
2752  layer->m_BasicParameters.m_InputToForgetWeights =
2753  std::make_shared<ScopedTensorHandle>(*(params.m_InputToForgetWeights));
2754  layer->m_BasicParameters.m_InputToCellWeights =
2755  std::make_shared<ScopedTensorHandle>(*(params.m_InputToCellWeights));
2756  layer->m_BasicParameters.m_InputToOutputWeights =
2757  std::make_shared<ScopedTensorHandle>(*(params.m_InputToOutputWeights));
2758  layer->m_BasicParameters.m_RecurrentToForgetWeights =
2759  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToForgetWeights));
2760  layer->m_BasicParameters.m_RecurrentToCellWeights =
2761  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToCellWeights));
2762  layer->m_BasicParameters.m_RecurrentToOutputWeights =
2763  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToOutputWeights));
2764  layer->m_BasicParameters.m_ForgetGateBias =
2765  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetGateBias));
2766  layer->m_BasicParameters.m_CellBias =
2767  std::make_shared<ScopedTensorHandle>(*(params.m_CellBias));
2768  layer->m_BasicParameters.m_OutputGateBias =
2769  std::make_shared<ScopedTensorHandle>(*(params.m_OutputGateBias));
2770 
2771  // QLstm Cifg parameters
2772  if(!descriptor.m_CifgEnabled)
2773  {
2774  if(params.m_InputToInputWeights == nullptr)
2775  {
2776  throw InvalidArgumentException("AddQLstmLayer: Input To Input Weights cannot be NULL");
2777  }
2778 
2779  if(params.m_RecurrentToInputWeights == nullptr)
2780  {
2781  throw InvalidArgumentException(
2782  "AddQLstmLayer: Recurrent To Input Weights cannot be NULL");
2783  }
2784 
2785  if(params.m_InputGateBias == nullptr)
2786  {
2787  throw InvalidArgumentException("AddQLstmLayer: Input Gate Bias cannot be NULL");
2788  }
2789 
2790  layer->m_CifgParameters.m_InputToInputWeights =
2791  std::make_shared<ScopedTensorHandle>(*(params.m_InputToInputWeights));
2792  layer->m_CifgParameters.m_RecurrentToInputWeights =
2793  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToInputWeights));
2794  layer->m_CifgParameters.m_InputGateBias =
2795  std::make_shared<ScopedTensorHandle>(*(params.m_InputGateBias));
2796  }
2797 
2798  // QLstm Projection parameters
2799  if(descriptor.m_ProjectionEnabled)
2800  {
2801  if(params.m_ProjectionWeights == nullptr)
2802  {
2803  throw InvalidArgumentException("AddQLstmLayer: Projection Weights cannot be NULL");
2804  }
2805 
2806  layer->m_ProjectionParameters.m_ProjectionWeights =
2807  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionWeights));
2808 
2809  // Projection bias is optional even if projection is enabled
2810  if(params.m_ProjectionBias != nullptr)
2811  {
2812  layer->m_ProjectionParameters.m_ProjectionBias =
2813  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionBias));
2814  }
2815 
2816  }
2817 
2818  // QLstm Peephole params
2819  if(descriptor.m_PeepholeEnabled)
2820  {
2821  if(params.m_CellToForgetWeights == nullptr)
2822  {
2823  throw InvalidArgumentException("AddQLstmLayer: Cell To Forget Weights cannot be NULL");
2824  }
2825 
2826  if(params.m_CellToOutputWeights == nullptr)
2827  {
2828  throw InvalidArgumentException("AddQLstmLayer: Cell To Output Weights cannot be NULL");
2829  }
2830 
2831  if(!descriptor.m_CifgEnabled)
2832  {
2833  if(params.m_CellToInputWeights == nullptr)
2834  {
2835  throw InvalidArgumentException("AddQLstmLayer: Cell To Input Weights cannot be NULL");
2836  }
2837 
2838  layer->m_PeepholeParameters.m_CellToInputWeights =
2839  std::make_shared<ScopedTensorHandle>(*(params.m_CellToInputWeights));
2840  }
2841 
2842  layer->m_PeepholeParameters.m_CellToForgetWeights =
2843  std::make_shared<ScopedTensorHandle>(*(params.m_CellToForgetWeights));
2844  layer->m_PeepholeParameters.m_CellToOutputWeights =
2845  std::make_shared<ScopedTensorHandle>(*(params.m_CellToOutputWeights));
2846  }
2847 
2848  // QLstm Layer Normalization params
2849  if(descriptor.m_LayerNormEnabled)
2850  {
2851  if(params.m_ForgetLayerNormWeights == nullptr)
2852  {
2853  throw InvalidArgumentException("AddQLstmLayer: Forget layer normalization weights cannot be NULL");
2854  }
2855 
2856  if(params.m_CellLayerNormWeights == nullptr)
2857  {
2858  throw InvalidArgumentException("AddQLstmLayer: Cell layer normalization weights cannot be NULL");
2859  }
2860 
2861  if(params.m_OutputLayerNormWeights == nullptr)
2862  {
2863  throw InvalidArgumentException("AddQLstmLayer: Output layer normalization weights cannot be NULL");
2864  }
2865 
2866  if(!descriptor.m_CifgEnabled)
2867  {
2868  if(params.m_InputLayerNormWeights == nullptr)
2869  {
2870  throw InvalidArgumentException("AddQLstmLayer: Input layer normalization weights cannot be NULL");
2871  }
2872 
2873  layer->m_LayerNormParameters.m_InputLayerNormWeights =
2874  std::make_shared<ScopedTensorHandle>(*(params.m_InputLayerNormWeights));
2875  }
2876 
2877  layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2878  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetLayerNormWeights));
2879  layer->m_LayerNormParameters.m_CellLayerNormWeights =
2880  std::make_shared<ScopedTensorHandle>(*(params.m_CellLayerNormWeights));
2881  layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2882  std::make_shared<ScopedTensorHandle>(*(params.m_OutputLayerNormWeights));
2883  }
2884  return layer;
2885 }

References QLstmLayer::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, QLstmBasicParameters::m_InputToForgetWeights, LstmInputParams::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.

◆ AddQuantizedLstmLayer()

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

Definition at line 2707 of file Network.cpp.

2709 {
2710  const auto layer = m_Graph->AddLayer<QuantizedLstmLayer>(name);
2711 
2712  // InputToX weights
2713  layer->m_QuantizedLstmParameters.m_InputToInputWeights =
2714  std::make_shared<ScopedTensorHandle>(params.GetInputToInputWeights());
2715  layer->m_QuantizedLstmParameters.m_InputToForgetWeights =
2716  std::make_shared<ScopedTensorHandle>(params.GetInputToForgetWeights());
2717  layer->m_QuantizedLstmParameters.m_InputToCellWeights =
2718  std::make_shared<ScopedTensorHandle>(params.GetInputToCellWeights());
2719  layer->m_QuantizedLstmParameters.m_InputToOutputWeights =
2720  std::make_shared<ScopedTensorHandle>(params.GetInputToOutputWeights());
2721 
2722  // RecurrentToX weights
2723  layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights =
2724  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToInputWeights());
2725  layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights =
2726  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToForgetWeights());
2727  layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights =
2728  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToCellWeights());
2729  layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights =
2730  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToOutputWeights());
2731 
2732  // Bias
2733  layer->m_QuantizedLstmParameters.m_InputGateBias =
2734  std::make_shared<ScopedTensorHandle>(params.GetInputGateBias());
2735  layer->m_QuantizedLstmParameters.m_ForgetGateBias =
2736  std::make_shared<ScopedTensorHandle>(params.GetForgetGateBias());
2737  layer->m_QuantizedLstmParameters.m_CellBias =
2738  std::make_shared<ScopedTensorHandle>(params.GetCellBias());
2739  layer->m_QuantizedLstmParameters.m_OutputGateBias =
2740  std::make_shared<ScopedTensorHandle>(params.GetOutputGateBias());
2741 
2742  return layer;
2743 }

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.

◆ AddQuantizeLayer()

IConnectableLayer * AddQuantizeLayer ( const char *  name = nullptr)

Definition at line 2624 of file Network.cpp.

2625 {
2626  return m_Graph->AddLayer<QuantizeLayer>(name);
2627 }

◆ AddRankLayer()

IConnectableLayer * AddRankLayer ( const char *  name = nullptr)

Definition at line 2392 of file Network.cpp.

2393 {
2394  return m_Graph->AddLayer<RankLayer>(name);
2395 }

◆ AddReduceLayer()

IConnectableLayer * AddReduceLayer ( const ReduceDescriptor reduceDescriptor,
const char *  name = nullptr 
)

Definition at line 2397 of file Network.cpp.

2399 {
2400  return m_Graph->AddLayer<ReduceLayer>(reduceDescriptor, name);
2401 }

◆ AddReshapeLayer()

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

Definition at line 2440 of file Network.cpp.

2442 {
2443  return m_Graph->AddLayer<ReshapeLayer>(reshapeDescriptor, name);
2444 }

◆ AddResizeLayer()

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

Definition at line 2403 of file Network.cpp.

2404 {
2405  return m_Graph->AddLayer<ResizeLayer>(resizeDescriptor, name);
2406 }

◆ AddReverseV2Layer()

IConnectableLayer * AddReverseV2Layer ( const char *  name = nullptr)

Definition at line 3040 of file Network.cpp.

3041 {
3042  return m_Graph->AddLayer<ReverseV2Layer>(name);
3043 }

◆ AddShapeLayer()

IConnectableLayer * AddShapeLayer ( const char *  name = nullptr)

Definition at line 2408 of file Network.cpp.

2409 {
2410  return m_Graph->AddLayer<ShapeLayer>(name);
2411 }

◆ AddSliceLayer()

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

Definition at line 2333 of file Network.cpp.

2334 {
2335  return m_Graph->AddLayer<SliceLayer>(sliceDescriptor, name);
2336 }

◆ AddSoftmaxLayer()

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

Definition at line 2338 of file Network.cpp.

2340 {
2341  return m_Graph->AddLayer<SoftmaxLayer>(softmaxDescriptor, name);
2342 }

◆ AddSpaceToBatchNdLayer()

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

Definition at line 2446 of file Network.cpp.

2448 {
2449  return m_Graph->AddLayer<SpaceToBatchNdLayer>(spaceToBatchNdDescriptor, name);
2450 }

◆ AddSpaceToDepthLayer()

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

Definition at line 2452 of file Network.cpp.

2454 {
2455  return m_Graph->AddLayer<SpaceToDepthLayer>(spaceToDepthDescriptor, name);
2456 }

◆ AddSplitterLayer()

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

Definition at line 2344 of file Network.cpp.

2346 {
2347  return m_Graph->AddLayer<SplitterLayer>(splitterDescriptor, name);
2348 }

◆ AddStackLayer()

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

Definition at line 2694 of file Network.cpp.

2696 {
2697  return m_Graph->AddLayer<StackLayer>(stackDescriptor, name);
2698 }

◆ AddStandInLayer()

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

Definition at line 2701 of file Network.cpp.

2703 {
2704  return m_Graph->AddLayer<StandInLayer>(desc, name);
2705 }

◆ AddStridedSliceLayer()

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

Definition at line 2634 of file Network.cpp.

2636 {
2637  return m_Graph->AddLayer<StridedSliceLayer>(stridedSliceDescriptor, name);
2638 }

◆ AddSubtractionLayer()

IConnectableLayer * AddSubtractionLayer ( const char *  name = nullptr)

Definition at line 2609 of file Network.cpp.

2610 {
2611  return m_Graph->AddLayer<SubtractionLayer>(name);
2612 }

◆ AddSwitchLayer()

IConnectableLayer * AddSwitchLayer ( const char *  name = nullptr)

Definition at line 2656 of file Network.cpp.

2657 {
2658  return m_Graph->AddLayer<SwitchLayer>(name);
2659 }

◆ AddTileLayer()

IConnectableLayer * AddTileLayer ( const TileDescriptor tileDescriptor,
const char *  name = nullptr 
)

Definition at line 3045 of file Network.cpp.

3046 {
3047  return m_Graph->AddLayer<TileLayer>(desc, name);
3048 }

◆ AddTransposeConvolution2dLayer()

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

Definition at line 2666 of file Network.cpp.

2670 {
2671  if (descriptor.m_BiasEnabled && !biases.has_value())
2672  {
2673  throw InvalidArgumentException("AddTransposeConvolution2dLayer: Biases cannot be empty");
2674  }
2675 
2676  const auto layer = m_Graph->AddLayer<TransposeConvolution2dLayer>(descriptor, name);
2677 
2678  layer->m_Weight = std::make_shared<ScopedTensorHandle>(weights);
2679 
2680  if (descriptor.m_BiasEnabled)
2681  {
2682  layer->m_Bias = std::make_shared<ScopedTensorHandle>(biases.value());
2683  }
2684 
2685  return layer;
2686 }

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

◆ AddTransposeLayer()

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

Definition at line 2688 of file Network.cpp.

2690 {
2691  return m_Graph->AddLayer<TransposeLayer>(transposeDescriptor, name);
2692 }

◆ AddUnidirectionalSequenceLstmLayer()

IConnectableLayer * AddUnidirectionalSequenceLstmLayer ( const UnidirectionalSequenceLstmDescriptor descriptor,
const LstmInputParams params,
const char *  name = nullptr 
)

Definition at line 2893 of file Network.cpp.

2897 {
2898  const auto layer = m_Graph->AddLayer<UnidirectionalSequenceLstmLayer>(descriptor, name);
2899 
2900  //Lstm Basic Parameters
2901  layer->m_BasicParameters.m_InputToForgetWeights =
2902  std::make_shared<ScopedTensorHandle>(*(params.m_InputToForgetWeights));
2903  layer->m_BasicParameters.m_InputToCellWeights =
2904  std::make_shared<ScopedTensorHandle>(*(params.m_InputToCellWeights));
2905  layer->m_BasicParameters.m_InputToOutputWeights =
2906  std::make_shared<ScopedTensorHandle>(*(params.m_InputToOutputWeights));
2907  layer->m_BasicParameters.m_RecurrentToForgetWeights =
2908  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToForgetWeights));
2909  layer->m_BasicParameters.m_RecurrentToCellWeights =
2910  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToCellWeights));
2911  layer->m_BasicParameters.m_RecurrentToOutputWeights =
2912  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToOutputWeights));
2913  layer->m_BasicParameters.m_ForgetGateBias =
2914  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetGateBias));
2915  layer->m_BasicParameters.m_CellBias =
2916  std::make_shared<ScopedTensorHandle>(*(params.m_CellBias));
2917  layer->m_BasicParameters.m_OutputGateBias =
2918  std::make_shared<ScopedTensorHandle>(*(params.m_OutputGateBias));
2919 
2920  //Lstm Cifg parameters
2921  if(!descriptor.m_CifgEnabled)
2922  {
2923  if(params.m_InputToInputWeights == nullptr)
2924  {
2925  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Input To Input Weights cannot be NULL "
2926  "when CIFG is disabled.");
2927  }
2928  if(params.m_RecurrentToInputWeights == nullptr)
2929  {
2930  throw InvalidArgumentException(
2931  "AddUnidirectionalSequenceLstmLayer: Recurrent To Input Weights cannot be NULL "
2932  "when CIFG is disabled.");
2933  }
2934  if(params.m_InputGateBias == nullptr)
2935  {
2936  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Input Gate Bias cannot be NULL "
2937  "when CIFG is disabled.");
2938  }
2939  layer->m_CifgParameters.m_InputToInputWeights =
2940  std::make_shared<ScopedTensorHandle>(*(params.m_InputToInputWeights));
2941  layer->m_CifgParameters.m_RecurrentToInputWeights =
2942  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToInputWeights));
2943  layer->m_CifgParameters.m_InputGateBias =
2944  std::make_shared<ScopedTensorHandle>(*(params.m_InputGateBias));
2945  }
2946 
2947  //Lstm projection parameters
2948  if(descriptor.m_ProjectionEnabled)
2949  {
2950  if(params.m_ProjectionWeights == nullptr)
2951  {
2952  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Projection Weights cannot be NULL "
2953  "when projection is enabled.");
2954  }
2955  layer->m_ProjectionParameters.m_ProjectionWeights =
2956  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionWeights));
2957  if(params.m_ProjectionBias != nullptr)
2958  {
2959  layer->m_ProjectionParameters.m_ProjectionBias =
2960  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionBias));
2961  }
2962  }
2963 
2964  //Lstm Peephole params
2965  if(descriptor.m_PeepholeEnabled)
2966  {
2967  if(!descriptor.m_CifgEnabled)
2968  {
2969  if(params.m_CellToInputWeights == nullptr)
2970  {
2971  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Cell To Input Weights "
2972  "cannot be NULL when Peephole is enabled and CIFG disabled.");
2973  }
2974 
2975  layer->m_PeepholeParameters.m_CellToInputWeights =
2976  std::make_shared<ScopedTensorHandle>(*(params.m_CellToInputWeights));
2977  }
2978 
2979  if(params.m_CellToForgetWeights == nullptr)
2980  {
2981  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Cell To Forget Weights cannot be NULL "
2982  "when Peephole is enabled.");
2983  }
2984  if(params.m_CellToOutputWeights == nullptr)
2985  {
2986  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Cell To Output Weights cannot be NULL "
2987  "when Peephole is enabled.");
2988  }
2989 
2990  layer->m_PeepholeParameters.m_CellToForgetWeights =
2991  std::make_shared<ScopedTensorHandle>(*(params.m_CellToForgetWeights));
2992  layer->m_PeepholeParameters.m_CellToOutputWeights =
2993  std::make_shared<ScopedTensorHandle>(*(params.m_CellToOutputWeights));
2994  }
2995 
2996  //Lstm Layer Normalization params
2997  if(descriptor.m_LayerNormEnabled)
2998  {
2999  if(!descriptor.m_CifgEnabled)
3000  {
3001  if(params.m_InputLayerNormWeights == nullptr)
3002  {
3003  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Input layer normalization weights "
3004  "cannot be NULL when layer normalization is enabled and CIFG disabled.");
3005  }
3006  layer->m_LayerNormParameters.m_InputLayerNormWeights =
3007  std::make_shared<ScopedTensorHandle>(*(params.m_InputLayerNormWeights));
3008  }
3009 
3010  if(params.m_ForgetLayerNormWeights == nullptr)
3011  {
3012  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Forget layer normalization weights "
3013  "cannot be NULL when layer normalization is enabled.");
3014  }
3015  if(params.m_CellLayerNormWeights == nullptr)
3016  {
3017  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Cell layer normalization weights "
3018  "cannot be NULL when layer normalization is enabled.");
3019  }
3020  if(params.m_OutputLayerNormWeights == nullptr)
3021  {
3022  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Output layer normalization weights "
3023  "cannot be NULL when layer normalization is enabled.");
3024  }
3025  layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
3026  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetLayerNormWeights));
3027  layer->m_LayerNormParameters.m_CellLayerNormWeights =
3028  std::make_shared<ScopedTensorHandle>(*(params.m_CellLayerNormWeights));
3029  layer->m_LayerNormParameters.m_OutputLayerNormWeights =
3030  std::make_shared<ScopedTensorHandle>(*(params.m_OutputLayerNormWeights));
3031  }
3032  return layer;
3033 }

References UnidirectionalSequenceLstmLayer::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.

◆ ExecuteStrategy()

void ExecuteStrategy ( IStrategy strategy) const

Definition at line 3088 of file Network.cpp.

3089 {
3090  for (auto layer : GetGraph())
3091  {
3092  layer->ExecuteStrategy(strategy);
3093  };
3094 }

References NetworkImpl::GetGraph().

◆ GetGraph()

const Graph& GetGraph ( ) const
inline

Definition at line 38 of file Network.hpp.

39  { return *m_Graph; }

Referenced by NetworkImpl::ExecuteStrategy().

◆ PrintGraph()

Status PrintGraph ( )

Definition at line 2182 of file Network.cpp.

2183 {
2184  m_Graph->Print();
2185  return Status::Success;
2186 }

References armnn::Success.


The documentation for this class was generated from the following files:
armnn::NetworkImpl::GetGraph
const Graph & GetGraph() const
Definition: Network.hpp:38
armnn::Status::Success
@ Success