ArmNN
 24.11
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)
 
IConnectableLayerAddScatterNdLayer (const ScatterNdDescriptor &scatterDescriptor, 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 2320 of file Network.cpp.

2321 : m_NetworkOptions(networkOptions),
2322  m_Graph(std::make_unique<Graph>(GetShapeInferenceMethod(), GetAllowExpandedDims()))
2323 {}

◆ ~NetworkImpl()

Definition at line 2325 of file Network.cpp.

2326 {
2327 }

Member Function Documentation

◆ AddActivationLayer()

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

Definition at line 2461 of file Network.cpp.

2463 {
2464  return m_Graph->AddLayer<ActivationLayer>(activationDescriptor, name);
2465 }

◆ AddAdditionLayer()

IConnectableLayer * AddAdditionLayer ( const char *  name = nullptr)

Definition at line 2507 of file Network.cpp.

2508 {
2509  return m_Graph->AddLayer<AdditionLayer>(name);
2510 }

◆ AddArgMinMaxLayer()

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

Definition at line 2467 of file Network.cpp.

2469 {
2470  return m_Graph->AddLayer<ArgMinMaxLayer>(argMinMaxDescriptor, name);
2471 }

◆ AddBatchMatMulLayer()

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

Definition at line 3182 of file Network.cpp.

3183 {
3184  return m_Graph->AddLayer<BatchMatMulLayer>(desc, name);
3185 }

◆ 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 2522 of file Network.cpp.

2528 {
2529  const auto layer = m_Graph->AddLayer<BatchNormalizationLayer>(desc, name);
2530 
2531  layer->m_Mean = std::make_shared<ScopedTensorHandle>(mean);
2532  layer->m_Variance = std::make_shared<ScopedTensorHandle>(variance);
2533  layer->m_Beta = std::make_shared<ScopedTensorHandle>(beta);
2534  layer->m_Gamma = std::make_shared<ScopedTensorHandle>(gamma);
2535 
2536  return layer;
2537 }

References BatchNormalizationLayer::m_Mean.

◆ AddBatchToSpaceNdLayer()

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

Definition at line 2340 of file Network.cpp.

2342 {
2343  return m_Graph->AddLayer<BatchToSpaceNdLayer>(batchToSpaceNdDescriptor, name);
2344 }

◆ AddBroadcastToLayer()

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

Definition at line 3230 of file Network.cpp.

3231 {
3232  return m_Graph->AddLayer<BroadcastToLayer>(desc, name);
3233 }

◆ AddCastLayer()

IConnectableLayer * AddCastLayer ( const char *  name = nullptr)

Definition at line 2346 of file Network.cpp.

2347 {
2348  return m_Graph->AddLayer<CastLayer>(name);
2349 }

◆ AddChannelShuffleLayer()

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

Definition at line 2350 of file Network.cpp.

2352 {
2353  return m_Graph->AddLayer<ChannelShuffleLayer>(channelShuffleDescriptor, name);
2354 }

◆ AddComparisonLayer()

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

Definition at line 2356 of file Network.cpp.

2358 {
2359  return m_Graph->AddLayer<ComparisonLayer>(comparisonDescriptor, name);
2360 }

◆ AddConcatLayer()

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

Definition at line 2392 of file Network.cpp.

2394 {
2395  return m_Graph->AddLayer<ConcatLayer>(concatDescriptor, name);
2396 }

◆ AddConstantLayer()

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

Definition at line 2578 of file Network.cpp.

2579 {
2580  auto layer = m_Graph->AddLayer<ConstantLayer>(name);
2581 
2582  layer->m_LayerOutput = std::make_shared<ScopedTensorHandle>(input);
2583 
2584  return layer;
2585 }

References ConstantLayer::m_LayerOutput.

◆ AddConvertFp16ToFp32Layer()

IConnectableLayer * AddConvertFp16ToFp32Layer ( const char *  name = nullptr)

Definition at line 2404 of file Network.cpp.

2405 {
2406  return m_Graph->AddLayer<ConvertFp16ToFp32Layer>(name);
2407 }

◆ AddConvertFp32ToFp16Layer()

IConnectableLayer * AddConvertFp32ToFp16Layer ( const char *  name = nullptr)

Definition at line 2409 of file Network.cpp.

2410 {
2411  return m_Graph->AddLayer<ConvertFp32ToFp16Layer>(name);
2412 }

◆ AddConvolution2dLayer()

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

Definition at line 2398 of file Network.cpp.

2400 {
2401  return m_Graph->AddLayer<Convolution2dLayer>(convolution2dDescriptor, name);
2402 }

◆ AddConvolution3dLayer()

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

Definition at line 2414 of file Network.cpp.

2416 {
2417  return m_Graph->AddLayer<Convolution3dLayer>(convolution3dDescriptor, name);
2418 }

◆ AddDepthToSpaceLayer()

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

Definition at line 2420 of file Network.cpp.

2422 {
2423  return m_Graph->AddLayer<DepthToSpaceLayer>(depthToSpaceDescriptor, name);
2424 }

◆ AddDepthwiseConvolution2dLayer()

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

Definition at line 2426 of file Network.cpp.

2429 {
2430  return m_Graph->AddLayer<DepthwiseConvolution2dLayer>(convolution2dDescriptor, name);
2431 }

◆ AddDequantizeLayer()

IConnectableLayer * AddDequantizeLayer ( const char *  name = nullptr)

Definition at line 2776 of file Network.cpp.

2777 {
2778  return m_Graph->AddLayer<DequantizeLayer>(name);
2779 }

◆ AddDetectionPostProcessLayer()

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

Definition at line 2433 of file Network.cpp.

2435 {
2436  const auto layer = m_Graph->AddLayer<DetectionPostProcessLayer>(descriptor, name);
2437 
2438  layer->m_Anchors = std::make_shared<ScopedTensorHandle>(anchors);
2439 
2440  return layer;
2441 }

References DetectionPostProcessLayer::m_Anchors.

◆ AddDivisionLayer()

IConnectableLayer * AddDivisionLayer ( const char *  name = nullptr)

Definition at line 2751 of file Network.cpp.

2752 {
2753  return m_Graph->AddLayer<DivisionLayer>(name);
2754 }

◆ AddElementwiseBinaryLayer()

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

Definition at line 2362 of file Network.cpp.

2364 {
2365  return m_Graph->AddLayer<ElementwiseBinaryLayer>(elementwiseBinaryDesc, name);
2366 }

◆ AddElementwiseUnaryLayer()

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

Definition at line 2368 of file Network.cpp.

2370 {
2371  return m_Graph->AddLayer<ElementwiseUnaryLayer>(elementwiseUnaryDescriptor, name);
2372 }

◆ AddFillLayer()

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

Definition at line 2374 of file Network.cpp.

2376 {
2377  return m_Graph->AddLayer<FillLayer>(fillDescriptor, name);
2378 }

◆ AddFloorLayer()

IConnectableLayer * AddFloorLayer ( const char *  name = nullptr)

Definition at line 2605 of file Network.cpp.

2606 {
2607  return m_Graph->AddLayer<FloorLayer>(name);
2608 }

◆ AddFullyConnectedLayer()

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

Definition at line 2380 of file Network.cpp.

2382 {
2383  return m_Graph->AddLayer<FullyConnectedLayer>(fullyConnectedDescriptor, name);
2384 }

◆ AddFusedLayer()

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

Definition at line 2386 of file Network.cpp.

2388 {
2389  return m_Graph->AddLayer<FusedLayer>(fusedDescriptor, name);
2390 }

◆ AddGatherLayer()

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

Definition at line 2787 of file Network.cpp.

2789 {
2790  return m_Graph->AddLayer<GatherLayer>(gatherDescriptor, name);
2791 }

◆ AddGatherNdLayer()

IConnectableLayer * AddGatherNdLayer ( const char *  name = nullptr)

Definition at line 2793 of file Network.cpp.

2794 {
2795  return m_Graph->AddLayer<GatherNdLayer>(name);
2796 }

◆ AddInputLayer()

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

Definition at line 2335 of file Network.cpp.

2336 {
2337  return m_Graph->AddLayer<InputLayer>(id, name);
2338 }

◆ AddInstanceNormalizationLayer()

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

Definition at line 2560 of file Network.cpp.

2562 {
2563  return m_Graph->AddLayer<InstanceNormalizationLayer>(desc, name);
2564 }

◆ AddL2NormalizationLayer()

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

Definition at line 2566 of file Network.cpp.

2568 {
2569  return m_Graph->AddLayer<L2NormalizationLayer>(desc, name);
2570 }

◆ AddLogicalBinaryLayer()

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

Definition at line 3034 of file Network.cpp.

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

◆ AddLogSoftmaxLayer()

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

Definition at line 2572 of file Network.cpp.

2574 {
2575  return m_Graph->AddLayer<LogSoftmaxLayer>(desc, name);
2576 }

◆ AddLstmLayer()

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

Definition at line 2610 of file Network.cpp.

2613 {
2614  const auto layer = m_Graph->AddLayer<LstmLayer>(descriptor, name);
2615 
2616  //Lstm Basic Parameters
2617  layer->m_BasicParameters.m_InputToForgetWeights =
2618  std::make_shared<ScopedTensorHandle>(*(params.m_InputToForgetWeights));
2619  layer->m_BasicParameters.m_InputToCellWeights =
2620  std::make_shared<ScopedTensorHandle>(*(params.m_InputToCellWeights));
2621  layer->m_BasicParameters.m_InputToOutputWeights =
2622  std::make_shared<ScopedTensorHandle>(*(params.m_InputToOutputWeights));
2623  layer->m_BasicParameters.m_RecurrentToForgetWeights =
2624  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToForgetWeights));
2625  layer->m_BasicParameters.m_RecurrentToCellWeights =
2626  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToCellWeights));
2627  layer->m_BasicParameters.m_RecurrentToOutputWeights =
2628  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToOutputWeights));
2629  layer->m_BasicParameters.m_ForgetGateBias =
2630  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetGateBias));
2631  layer->m_BasicParameters.m_CellBias =
2632  std::make_shared<ScopedTensorHandle>(*(params.m_CellBias));
2633  layer->m_BasicParameters.m_OutputGateBias =
2634  std::make_shared<ScopedTensorHandle>(*(params.m_OutputGateBias));
2635 
2636  //Lstm Cifg parameters
2637  if(!descriptor.m_CifgEnabled)
2638  {
2639  if(params.m_InputToInputWeights == nullptr)
2640  {
2641  throw InvalidArgumentException("AddLstmLayer: Input To Input Weights cannot be NULL "
2642  "when CIFG is disabled.");
2643  }
2644  if(params.m_RecurrentToInputWeights == nullptr)
2645  {
2646  throw InvalidArgumentException(
2647  "AddLstmLayer: Recurrent To Input Weights cannot be NULL "
2648  "when CIFG is disabled.");
2649  }
2650  if(params.m_InputGateBias == nullptr)
2651  {
2652  throw InvalidArgumentException("AddLstmLayer: Input Gate Bias cannot be NULL "
2653  "when CIFG is disabled.");
2654  }
2655  layer->m_CifgParameters.m_InputToInputWeights =
2656  std::make_shared<ScopedTensorHandle>(*(params.m_InputToInputWeights));
2657  layer->m_CifgParameters.m_RecurrentToInputWeights =
2658  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToInputWeights));
2659  layer->m_CifgParameters.m_InputGateBias =
2660  std::make_shared<ScopedTensorHandle>(*(params.m_InputGateBias));
2661  }
2662 
2663  //Lstm projection parameters
2664  if(descriptor.m_ProjectionEnabled)
2665  {
2666  if(params.m_ProjectionWeights == nullptr)
2667  {
2668  throw InvalidArgumentException("AddLstmLayer: Projection Weights cannot be NULL "
2669  "when projection is enabled.");
2670  }
2671  layer->m_ProjectionParameters.m_ProjectionWeights =
2672  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionWeights));
2673  if(params.m_ProjectionBias != nullptr)
2674  {
2675  layer->m_ProjectionParameters.m_ProjectionBias =
2676  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionBias));
2677  }
2678  }
2679 
2680  //Lstm Peephole params
2681  if(descriptor.m_PeepholeEnabled)
2682  {
2683  if(!descriptor.m_CifgEnabled)
2684  {
2685  if(params.m_CellToInputWeights == nullptr)
2686  {
2687  throw InvalidArgumentException("AddLstmLayer: Cell To Input Weights cannot be NULL "
2688  "when Peephole is enabled and CIFG disabled.");
2689  }
2690 
2691  layer->m_PeepholeParameters.m_CellToInputWeights =
2692  std::make_shared<ScopedTensorHandle>(*(params.m_CellToInputWeights));
2693  }
2694 
2695  if(params.m_CellToForgetWeights == nullptr)
2696  {
2697  throw InvalidArgumentException("AddLstmLayer: Cell To Forget Weights cannot be NULL "
2698  "when Peephole is enabled.");
2699  }
2700  if(params.m_CellToOutputWeights == nullptr)
2701  {
2702  throw InvalidArgumentException("AddLstmLayer: Cell To Output Weights cannot be NULL "
2703  "when Peephole is enabled.");
2704  }
2705 
2706  layer->m_PeepholeParameters.m_CellToForgetWeights =
2707  std::make_shared<ScopedTensorHandle>(*(params.m_CellToForgetWeights));
2708  layer->m_PeepholeParameters.m_CellToOutputWeights =
2709  std::make_shared<ScopedTensorHandle>(*(params.m_CellToOutputWeights));
2710  }
2711 
2712  //Lstm Layer Normalization params
2713  if(descriptor.m_LayerNormEnabled)
2714  {
2715  if(!descriptor.m_CifgEnabled)
2716  {
2717  if(params.m_InputLayerNormWeights == nullptr)
2718  {
2719  throw InvalidArgumentException("AddLstmLayer: Input layer normalization weights cannot be NULL "
2720  "when layer normalization is enabled and CIFG disabled.");
2721  }
2722  layer->m_LayerNormParameters.m_InputLayerNormWeights =
2723  std::make_shared<ScopedTensorHandle>(*(params.m_InputLayerNormWeights));
2724  }
2725 
2726  if(params.m_ForgetLayerNormWeights == nullptr)
2727  {
2728  throw InvalidArgumentException("AddLstmLayer: Forget layer normalization weights cannot be NULL "
2729  "when layer normalization is enabled.");
2730  }
2731  if(params.m_CellLayerNormWeights == nullptr)
2732  {
2733  throw InvalidArgumentException("AddLstmLayer: Cell layer normalization weights cannot be NULL "
2734  "when layer normalization is enabled.");
2735  }
2736  if(params.m_OutputLayerNormWeights == nullptr)
2737  {
2738  throw InvalidArgumentException("AddLstmLayer: Output layer normalization weights cannot be NULL "
2739  "when layer normalization is enabled.");
2740  }
2741  layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2742  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetLayerNormWeights));
2743  layer->m_LayerNormParameters.m_CellLayerNormWeights =
2744  std::make_shared<ScopedTensorHandle>(*(params.m_CellLayerNormWeights));
2745  layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2746  std::make_shared<ScopedTensorHandle>(*(params.m_OutputLayerNormWeights));
2747  }
2748  return layer;
2749 }

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 2497 of file Network.cpp.

2498 {
2499  return m_Graph->AddLayer<MaximumLayer>(name);
2500 }

◆ AddMeanLayer()

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

Definition at line 2761 of file Network.cpp.

2762 {
2763  return m_Graph->AddLayer<MeanLayer>(meanDescriptor,name);
2764 }

◆ AddMergeLayer()

IConnectableLayer * AddMergeLayer ( const char *  name = nullptr)

Definition at line 2798 of file Network.cpp.

2799 {
2800  return m_Graph->AddLayer<MergeLayer>(name);
2801 }

◆ AddMinimumLayer()

IConnectableLayer * AddMinimumLayer ( const char *  name = nullptr)

Definition at line 2502 of file Network.cpp.

2503 {
2504  return m_Graph->AddLayer<MinimumLayer>(name);
2505 }

◆ AddMultiplicationLayer()

IConnectableLayer * AddMultiplicationLayer ( const char *  name = nullptr)

Definition at line 2512 of file Network.cpp.

2513 {
2514  return m_Graph->AddLayer<MultiplicationLayer>(name);
2515 }

◆ AddNormalizationLayer()

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

Definition at line 2473 of file Network.cpp.

2476 {
2477  return m_Graph->AddLayer<NormalizationLayer>(normalizationDescriptor, name);
2478 }

◆ AddOutputLayer()

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

Definition at line 2517 of file Network.cpp.

2518 {
2519  return m_Graph->AddLayer<OutputLayer>(id, name);
2520 }

◆ AddPadLayer()

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

Definition at line 2766 of file Network.cpp.

2767 {
2768  return m_Graph->AddLayer<PadLayer>(padDescriptor,name);
2769 }

◆ AddPermuteLayer()

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

Definition at line 2443 of file Network.cpp.

2445 {
2446  return m_Graph->AddLayer<PermuteLayer>(permuteDescriptor, name);
2447 }

◆ AddPooling2dLayer()

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

Definition at line 2449 of file Network.cpp.

2451 {
2452  return m_Graph->AddLayer<Pooling2dLayer>(pooling2dDescriptor, name);
2453 }

◆ AddPooling3dLayer()

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

Definition at line 2455 of file Network.cpp.

2457 {
2458  return m_Graph->AddLayer<Pooling3dLayer>(pooling3dDescriptor, name);
2459 }

◆ AddPrecompiledLayer()

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

Definition at line 3197 of file Network.cpp.

3201 {
3202  // Method use is for backend users.
3203  PreCompiledLayer* layer;
3204  if (name)
3205  {
3206  layer = m_Graph->AddLayer<PreCompiledLayer>(preCompiledDescriptor, name);
3207  }
3208  else
3209  {
3210  layer = m_Graph->AddLayer<PreCompiledLayer>(preCompiledDescriptor, "pre-compiled");
3211  }
3212 
3213  // Assign the pre-compiled object to layer
3214  // Pass only one compiled network, Arm NN does not handle multiple
3215  // pre-compiled objects in a single pre-compiled layer currently
3216  layer->SetPreCompiledObject(std::move(compiledBlobPtr));
3217 
3218  if (backend.has_value())
3219  {
3220  layer->SetBackendId(backend.value());
3221  }
3222  else if (layer->GetBackendHint().has_value())
3223  {
3224  layer->SetBackendId(layer->GetBackendHint().value());
3225  }
3226 
3227  return layer;
3228 }

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 2808 of file Network.cpp.

2809 {
2810  return m_Graph->AddLayer<PreluLayer>(name);
2811 }

◆ AddQLstmLayer()

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

Definition at line 2892 of file Network.cpp.

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

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 2854 of file Network.cpp.

2856 {
2857  const auto layer = m_Graph->AddLayer<QuantizedLstmLayer>(name);
2858 
2859  // InputToX weights
2860  layer->m_QuantizedLstmParameters.m_InputToInputWeights =
2861  std::make_shared<ScopedTensorHandle>(params.GetInputToInputWeights());
2862  layer->m_QuantizedLstmParameters.m_InputToForgetWeights =
2863  std::make_shared<ScopedTensorHandle>(params.GetInputToForgetWeights());
2864  layer->m_QuantizedLstmParameters.m_InputToCellWeights =
2865  std::make_shared<ScopedTensorHandle>(params.GetInputToCellWeights());
2866  layer->m_QuantizedLstmParameters.m_InputToOutputWeights =
2867  std::make_shared<ScopedTensorHandle>(params.GetInputToOutputWeights());
2868 
2869  // RecurrentToX weights
2870  layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights =
2871  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToInputWeights());
2872  layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights =
2873  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToForgetWeights());
2874  layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights =
2875  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToCellWeights());
2876  layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights =
2877  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToOutputWeights());
2878 
2879  // Bias
2880  layer->m_QuantizedLstmParameters.m_InputGateBias =
2881  std::make_shared<ScopedTensorHandle>(params.GetInputGateBias());
2882  layer->m_QuantizedLstmParameters.m_ForgetGateBias =
2883  std::make_shared<ScopedTensorHandle>(params.GetForgetGateBias());
2884  layer->m_QuantizedLstmParameters.m_CellBias =
2885  std::make_shared<ScopedTensorHandle>(params.GetCellBias());
2886  layer->m_QuantizedLstmParameters.m_OutputGateBias =
2887  std::make_shared<ScopedTensorHandle>(params.GetOutputGateBias());
2888 
2889  return layer;
2890 }

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 2771 of file Network.cpp.

2772 {
2773  return m_Graph->AddLayer<QuantizeLayer>(name);
2774 }

◆ AddRankLayer()

IConnectableLayer * AddRankLayer ( const char *  name = nullptr)

Definition at line 2539 of file Network.cpp.

2540 {
2541  return m_Graph->AddLayer<RankLayer>(name);
2542 }

◆ AddReduceLayer()

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

Definition at line 2544 of file Network.cpp.

2546 {
2547  return m_Graph->AddLayer<ReduceLayer>(reduceDescriptor, name);
2548 }

◆ AddReshapeLayer()

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

Definition at line 2587 of file Network.cpp.

2589 {
2590  return m_Graph->AddLayer<ReshapeLayer>(reshapeDescriptor, name);
2591 }

◆ AddResizeLayer()

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

Definition at line 2550 of file Network.cpp.

2551 {
2552  return m_Graph->AddLayer<ResizeLayer>(resizeDescriptor, name);
2553 }

◆ AddReverseV2Layer()

IConnectableLayer * AddReverseV2Layer ( const char *  name = nullptr)

Definition at line 3187 of file Network.cpp.

3188 {
3189  return m_Graph->AddLayer<ReverseV2Layer>(name);
3190 }

◆ AddScatterNdLayer()

IConnectableLayer * AddScatterNdLayer ( const ScatterNdDescriptor scatterDescriptor,
const char *  name = nullptr 
)

Definition at line 3235 of file Network.cpp.

3236 {
3237  return m_Graph->AddLayer<ScatterNdLayer>(desc, name);
3238 }

◆ AddShapeLayer()

IConnectableLayer * AddShapeLayer ( const char *  name = nullptr)

Definition at line 2555 of file Network.cpp.

2556 {
2557  return m_Graph->AddLayer<ShapeLayer>(name);
2558 }

◆ AddSliceLayer()

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

Definition at line 2480 of file Network.cpp.

2481 {
2482  return m_Graph->AddLayer<SliceLayer>(sliceDescriptor, name);
2483 }

◆ AddSoftmaxLayer()

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

Definition at line 2485 of file Network.cpp.

2487 {
2488  return m_Graph->AddLayer<SoftmaxLayer>(softmaxDescriptor, name);
2489 }

◆ AddSpaceToBatchNdLayer()

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

Definition at line 2593 of file Network.cpp.

2595 {
2596  return m_Graph->AddLayer<SpaceToBatchNdLayer>(spaceToBatchNdDescriptor, name);
2597 }

◆ AddSpaceToDepthLayer()

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

Definition at line 2599 of file Network.cpp.

2601 {
2602  return m_Graph->AddLayer<SpaceToDepthLayer>(spaceToDepthDescriptor, name);
2603 }

◆ AddSplitterLayer()

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

Definition at line 2491 of file Network.cpp.

2493 {
2494  return m_Graph->AddLayer<SplitterLayer>(splitterDescriptor, name);
2495 }

◆ AddStackLayer()

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

Definition at line 2841 of file Network.cpp.

2843 {
2844  return m_Graph->AddLayer<StackLayer>(stackDescriptor, name);
2845 }

◆ AddStandInLayer()

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

Definition at line 2848 of file Network.cpp.

2850 {
2851  return m_Graph->AddLayer<StandInLayer>(desc, name);
2852 }

◆ AddStridedSliceLayer()

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

Definition at line 2781 of file Network.cpp.

2783 {
2784  return m_Graph->AddLayer<StridedSliceLayer>(stridedSliceDescriptor, name);
2785 }

◆ AddSubtractionLayer()

IConnectableLayer * AddSubtractionLayer ( const char *  name = nullptr)

Definition at line 2756 of file Network.cpp.

2757 {
2758  return m_Graph->AddLayer<SubtractionLayer>(name);
2759 }

◆ AddSwitchLayer()

IConnectableLayer * AddSwitchLayer ( const char *  name = nullptr)

Definition at line 2803 of file Network.cpp.

2804 {
2805  return m_Graph->AddLayer<SwitchLayer>(name);
2806 }

◆ AddTileLayer()

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

Definition at line 3192 of file Network.cpp.

3193 {
3194  return m_Graph->AddLayer<TileLayer>(desc, name);
3195 }

◆ AddTransposeConvolution2dLayer()

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

Definition at line 2813 of file Network.cpp.

2817 {
2818  if (descriptor.m_BiasEnabled && !biases.has_value())
2819  {
2820  throw InvalidArgumentException("AddTransposeConvolution2dLayer: Biases cannot be empty");
2821  }
2822 
2823  const auto layer = m_Graph->AddLayer<TransposeConvolution2dLayer>(descriptor, name);
2824 
2825  layer->m_Weight = std::make_shared<ScopedTensorHandle>(weights);
2826 
2827  if (descriptor.m_BiasEnabled)
2828  {
2829  layer->m_Bias = std::make_shared<ScopedTensorHandle>(biases.value());
2830  }
2831 
2832  return layer;
2833 }

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 2835 of file Network.cpp.

2837 {
2838  return m_Graph->AddLayer<TransposeLayer>(transposeDescriptor, name);
2839 }

◆ AddUnidirectionalSequenceLstmLayer()

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

Definition at line 3040 of file Network.cpp.

3044 {
3045  const auto layer = m_Graph->AddLayer<UnidirectionalSequenceLstmLayer>(descriptor, name);
3046 
3047  //Lstm Basic Parameters
3048  layer->m_BasicParameters.m_InputToForgetWeights =
3049  std::make_shared<ScopedTensorHandle>(*(params.m_InputToForgetWeights));
3050  layer->m_BasicParameters.m_InputToCellWeights =
3051  std::make_shared<ScopedTensorHandle>(*(params.m_InputToCellWeights));
3052  layer->m_BasicParameters.m_InputToOutputWeights =
3053  std::make_shared<ScopedTensorHandle>(*(params.m_InputToOutputWeights));
3054  layer->m_BasicParameters.m_RecurrentToForgetWeights =
3055  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToForgetWeights));
3056  layer->m_BasicParameters.m_RecurrentToCellWeights =
3057  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToCellWeights));
3058  layer->m_BasicParameters.m_RecurrentToOutputWeights =
3059  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToOutputWeights));
3060  layer->m_BasicParameters.m_ForgetGateBias =
3061  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetGateBias));
3062  layer->m_BasicParameters.m_CellBias =
3063  std::make_shared<ScopedTensorHandle>(*(params.m_CellBias));
3064  layer->m_BasicParameters.m_OutputGateBias =
3065  std::make_shared<ScopedTensorHandle>(*(params.m_OutputGateBias));
3066 
3067  //Lstm Cifg parameters
3068  if(!descriptor.m_CifgEnabled)
3069  {
3070  if(params.m_InputToInputWeights == nullptr)
3071  {
3072  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Input To Input Weights cannot be NULL "
3073  "when CIFG is disabled.");
3074  }
3075  if(params.m_RecurrentToInputWeights == nullptr)
3076  {
3077  throw InvalidArgumentException(
3078  "AddUnidirectionalSequenceLstmLayer: Recurrent To Input Weights cannot be NULL "
3079  "when CIFG is disabled.");
3080  }
3081  if(params.m_InputGateBias == nullptr)
3082  {
3083  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Input Gate Bias cannot be NULL "
3084  "when CIFG is disabled.");
3085  }
3086  layer->m_CifgParameters.m_InputToInputWeights =
3087  std::make_shared<ScopedTensorHandle>(*(params.m_InputToInputWeights));
3088  layer->m_CifgParameters.m_RecurrentToInputWeights =
3089  std::make_shared<ScopedTensorHandle>(*(params.m_RecurrentToInputWeights));
3090  layer->m_CifgParameters.m_InputGateBias =
3091  std::make_shared<ScopedTensorHandle>(*(params.m_InputGateBias));
3092  }
3093 
3094  //Lstm projection parameters
3095  if(descriptor.m_ProjectionEnabled)
3096  {
3097  if(params.m_ProjectionWeights == nullptr)
3098  {
3099  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Projection Weights cannot be NULL "
3100  "when projection is enabled.");
3101  }
3102  layer->m_ProjectionParameters.m_ProjectionWeights =
3103  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionWeights));
3104  if(params.m_ProjectionBias != nullptr)
3105  {
3106  layer->m_ProjectionParameters.m_ProjectionBias =
3107  std::make_shared<ScopedTensorHandle>(*(params.m_ProjectionBias));
3108  }
3109  }
3110 
3111  //Lstm Peephole params
3112  if(descriptor.m_PeepholeEnabled)
3113  {
3114  if(!descriptor.m_CifgEnabled)
3115  {
3116  if(params.m_CellToInputWeights == nullptr)
3117  {
3118  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Cell To Input Weights "
3119  "cannot be NULL when Peephole is enabled and CIFG disabled.");
3120  }
3121 
3122  layer->m_PeepholeParameters.m_CellToInputWeights =
3123  std::make_shared<ScopedTensorHandle>(*(params.m_CellToInputWeights));
3124  }
3125 
3126  if(params.m_CellToForgetWeights == nullptr)
3127  {
3128  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Cell To Forget Weights cannot be NULL "
3129  "when Peephole is enabled.");
3130  }
3131  if(params.m_CellToOutputWeights == nullptr)
3132  {
3133  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Cell To Output Weights cannot be NULL "
3134  "when Peephole is enabled.");
3135  }
3136 
3137  layer->m_PeepholeParameters.m_CellToForgetWeights =
3138  std::make_shared<ScopedTensorHandle>(*(params.m_CellToForgetWeights));
3139  layer->m_PeepholeParameters.m_CellToOutputWeights =
3140  std::make_shared<ScopedTensorHandle>(*(params.m_CellToOutputWeights));
3141  }
3142 
3143  //Lstm Layer Normalization params
3144  if(descriptor.m_LayerNormEnabled)
3145  {
3146  if(!descriptor.m_CifgEnabled)
3147  {
3148  if(params.m_InputLayerNormWeights == nullptr)
3149  {
3150  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Input layer normalization weights "
3151  "cannot be NULL when layer normalization is enabled and CIFG disabled.");
3152  }
3153  layer->m_LayerNormParameters.m_InputLayerNormWeights =
3154  std::make_shared<ScopedTensorHandle>(*(params.m_InputLayerNormWeights));
3155  }
3156 
3157  if(params.m_ForgetLayerNormWeights == nullptr)
3158  {
3159  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Forget layer normalization weights "
3160  "cannot be NULL when layer normalization is enabled.");
3161  }
3162  if(params.m_CellLayerNormWeights == nullptr)
3163  {
3164  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Cell layer normalization weights "
3165  "cannot be NULL when layer normalization is enabled.");
3166  }
3167  if(params.m_OutputLayerNormWeights == nullptr)
3168  {
3169  throw InvalidArgumentException("AddUnidirectionalSequenceLstmLayer: Output layer normalization weights "
3170  "cannot be NULL when layer normalization is enabled.");
3171  }
3172  layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
3173  std::make_shared<ScopedTensorHandle>(*(params.m_ForgetLayerNormWeights));
3174  layer->m_LayerNormParameters.m_CellLayerNormWeights =
3175  std::make_shared<ScopedTensorHandle>(*(params.m_CellLayerNormWeights));
3176  layer->m_LayerNormParameters.m_OutputLayerNormWeights =
3177  std::make_shared<ScopedTensorHandle>(*(params.m_OutputLayerNormWeights));
3178  }
3179  return layer;
3180 }

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 3240 of file Network.cpp.

3241 {
3242  for (auto layer : GetGraph())
3243  {
3244  layer->ExecuteStrategy(strategy);
3245  };
3246 }

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 2329 of file Network.cpp.

2330 {
2331  m_Graph->Print();
2332  return Status::Success;
2333 }

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