ArmNN
 24.08
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 2186 of file Network.cpp.

2187 : m_NetworkOptions(networkOptions),
2188  m_Graph(std::make_unique<Graph>(GetShapeInferenceMethod(), GetAllowExpandedDims()))
2189 {}

◆ ~NetworkImpl()

Definition at line 2191 of file Network.cpp.

2192 {
2193 }

Member Function Documentation

◆ AddActivationLayer()

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

Definition at line 2327 of file Network.cpp.

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

◆ AddAdditionLayer()

IConnectableLayer * AddAdditionLayer ( const char *  name = nullptr)

Definition at line 2373 of file Network.cpp.

2374 {
2375  return m_Graph->AddLayer<AdditionLayer>(name);
2376 }

◆ AddArgMinMaxLayer()

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

Definition at line 2333 of file Network.cpp.

2335 {
2336  return m_Graph->AddLayer<ArgMinMaxLayer>(argMinMaxDescriptor, name);
2337 }

◆ AddBatchMatMulLayer()

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

Definition at line 3048 of file Network.cpp.

3049 {
3050  return m_Graph->AddLayer<BatchMatMulLayer>(desc, name);
3051 }

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

2394 {
2395  const auto layer = m_Graph->AddLayer<BatchNormalizationLayer>(desc, name);
2396 
2397  layer->m_Mean = std::make_shared<ScopedTensorHandle>(mean);
2398  layer->m_Variance = std::make_shared<ScopedTensorHandle>(variance);
2399  layer->m_Beta = std::make_shared<ScopedTensorHandle>(beta);
2400  layer->m_Gamma = std::make_shared<ScopedTensorHandle>(gamma);
2401 
2402  return layer;
2403 }

References BatchNormalizationLayer::m_Mean.

◆ AddBatchToSpaceNdLayer()

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

Definition at line 2206 of file Network.cpp.

2208 {
2209  return m_Graph->AddLayer<BatchToSpaceNdLayer>(batchToSpaceNdDescriptor, name);
2210 }

◆ AddBroadcastToLayer()

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

Definition at line 3096 of file Network.cpp.

3097 {
3098  return m_Graph->AddLayer<BroadcastToLayer>(desc, name);
3099 }

◆ AddCastLayer()

IConnectableLayer * AddCastLayer ( const char *  name = nullptr)

Definition at line 2212 of file Network.cpp.

2213 {
2214  return m_Graph->AddLayer<CastLayer>(name);
2215 }

◆ AddChannelShuffleLayer()

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

Definition at line 2216 of file Network.cpp.

2218 {
2219  return m_Graph->AddLayer<ChannelShuffleLayer>(channelShuffleDescriptor, name);
2220 }

◆ AddComparisonLayer()

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

Definition at line 2222 of file Network.cpp.

2224 {
2225  return m_Graph->AddLayer<ComparisonLayer>(comparisonDescriptor, name);
2226 }

◆ AddConcatLayer()

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

Definition at line 2258 of file Network.cpp.

2260 {
2261  return m_Graph->AddLayer<ConcatLayer>(concatDescriptor, name);
2262 }

◆ AddConstantLayer()

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

Definition at line 2444 of file Network.cpp.

2445 {
2446  auto layer = m_Graph->AddLayer<ConstantLayer>(name);
2447 
2448  layer->m_LayerOutput = std::make_shared<ScopedTensorHandle>(input);
2449 
2450  return layer;
2451 }

References ConstantLayer::m_LayerOutput.

◆ AddConvertFp16ToFp32Layer()

IConnectableLayer * AddConvertFp16ToFp32Layer ( const char *  name = nullptr)

Definition at line 2270 of file Network.cpp.

2271 {
2272  return m_Graph->AddLayer<ConvertFp16ToFp32Layer>(name);
2273 }

◆ AddConvertFp32ToFp16Layer()

IConnectableLayer * AddConvertFp32ToFp16Layer ( const char *  name = nullptr)

Definition at line 2275 of file Network.cpp.

2276 {
2277  return m_Graph->AddLayer<ConvertFp32ToFp16Layer>(name);
2278 }

◆ AddConvolution2dLayer()

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

Definition at line 2264 of file Network.cpp.

2266 {
2267  return m_Graph->AddLayer<Convolution2dLayer>(convolution2dDescriptor, name);
2268 }

◆ AddConvolution3dLayer()

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

Definition at line 2280 of file Network.cpp.

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

◆ AddDepthToSpaceLayer()

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

Definition at line 2286 of file Network.cpp.

2288 {
2289  return m_Graph->AddLayer<DepthToSpaceLayer>(depthToSpaceDescriptor, name);
2290 }

◆ AddDepthwiseConvolution2dLayer()

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

Definition at line 2292 of file Network.cpp.

2295 {
2296  return m_Graph->AddLayer<DepthwiseConvolution2dLayer>(convolution2dDescriptor, name);
2297 }

◆ AddDequantizeLayer()

IConnectableLayer * AddDequantizeLayer ( const char *  name = nullptr)

Definition at line 2642 of file Network.cpp.

2643 {
2644  return m_Graph->AddLayer<DequantizeLayer>(name);
2645 }

◆ AddDetectionPostProcessLayer()

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

Definition at line 2299 of file Network.cpp.

2301 {
2302  const auto layer = m_Graph->AddLayer<DetectionPostProcessLayer>(descriptor, name);
2303 
2304  layer->m_Anchors = std::make_shared<ScopedTensorHandle>(anchors);
2305 
2306  return layer;
2307 }

References DetectionPostProcessLayer::m_Anchors.

◆ AddDivisionLayer()

IConnectableLayer * AddDivisionLayer ( const char *  name = nullptr)

Definition at line 2617 of file Network.cpp.

2618 {
2619  return m_Graph->AddLayer<DivisionLayer>(name);
2620 }

◆ AddElementwiseBinaryLayer()

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

Definition at line 2228 of file Network.cpp.

2230 {
2231  return m_Graph->AddLayer<ElementwiseBinaryLayer>(elementwiseBinaryDesc, name);
2232 }

◆ AddElementwiseUnaryLayer()

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

Definition at line 2234 of file Network.cpp.

2236 {
2237  return m_Graph->AddLayer<ElementwiseUnaryLayer>(elementwiseUnaryDescriptor, name);
2238 }

◆ AddFillLayer()

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

Definition at line 2240 of file Network.cpp.

2242 {
2243  return m_Graph->AddLayer<FillLayer>(fillDescriptor, name);
2244 }

◆ AddFloorLayer()

IConnectableLayer * AddFloorLayer ( const char *  name = nullptr)

Definition at line 2471 of file Network.cpp.

2472 {
2473  return m_Graph->AddLayer<FloorLayer>(name);
2474 }

◆ AddFullyConnectedLayer()

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

Definition at line 2246 of file Network.cpp.

2248 {
2249  return m_Graph->AddLayer<FullyConnectedLayer>(fullyConnectedDescriptor, name);
2250 }

◆ AddFusedLayer()

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

Definition at line 2252 of file Network.cpp.

2254 {
2255  return m_Graph->AddLayer<FusedLayer>(fusedDescriptor, name);
2256 }

◆ AddGatherLayer()

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

Definition at line 2653 of file Network.cpp.

2655 {
2656  return m_Graph->AddLayer<GatherLayer>(gatherDescriptor, name);
2657 }

◆ AddGatherNdLayer()

IConnectableLayer * AddGatherNdLayer ( const char *  name = nullptr)

Definition at line 2659 of file Network.cpp.

2660 {
2661  return m_Graph->AddLayer<GatherNdLayer>(name);
2662 }

◆ AddInputLayer()

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

Definition at line 2201 of file Network.cpp.

2202 {
2203  return m_Graph->AddLayer<InputLayer>(id, name);
2204 }

◆ AddInstanceNormalizationLayer()

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

Definition at line 2426 of file Network.cpp.

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

◆ AddL2NormalizationLayer()

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

Definition at line 2432 of file Network.cpp.

2434 {
2435  return m_Graph->AddLayer<L2NormalizationLayer>(desc, name);
2436 }

◆ AddLogicalBinaryLayer()

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

Definition at line 2900 of file Network.cpp.

2902 {
2903  return m_Graph->AddLayer<LogicalBinaryLayer>(logicalBinaryDescriptor, name);
2904 }

◆ AddLogSoftmaxLayer()

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

Definition at line 2438 of file Network.cpp.

2440 {
2441  return m_Graph->AddLayer<LogSoftmaxLayer>(desc, name);
2442 }

◆ AddLstmLayer()

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

Definition at line 2476 of file Network.cpp.

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

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

2364 {
2365  return m_Graph->AddLayer<MaximumLayer>(name);
2366 }

◆ AddMeanLayer()

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

Definition at line 2627 of file Network.cpp.

2628 {
2629  return m_Graph->AddLayer<MeanLayer>(meanDescriptor,name);
2630 }

◆ AddMergeLayer()

IConnectableLayer * AddMergeLayer ( const char *  name = nullptr)

Definition at line 2664 of file Network.cpp.

2665 {
2666  return m_Graph->AddLayer<MergeLayer>(name);
2667 }

◆ AddMinimumLayer()

IConnectableLayer * AddMinimumLayer ( const char *  name = nullptr)

Definition at line 2368 of file Network.cpp.

2369 {
2370  return m_Graph->AddLayer<MinimumLayer>(name);
2371 }

◆ AddMultiplicationLayer()

IConnectableLayer * AddMultiplicationLayer ( const char *  name = nullptr)

Definition at line 2378 of file Network.cpp.

2379 {
2380  return m_Graph->AddLayer<MultiplicationLayer>(name);
2381 }

◆ AddNormalizationLayer()

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

Definition at line 2339 of file Network.cpp.

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

◆ AddOutputLayer()

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

Definition at line 2383 of file Network.cpp.

2384 {
2385  return m_Graph->AddLayer<OutputLayer>(id, name);
2386 }

◆ AddPadLayer()

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

Definition at line 2632 of file Network.cpp.

2633 {
2634  return m_Graph->AddLayer<PadLayer>(padDescriptor,name);
2635 }

◆ AddPermuteLayer()

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

Definition at line 2309 of file Network.cpp.

2311 {
2312  return m_Graph->AddLayer<PermuteLayer>(permuteDescriptor, name);
2313 }

◆ AddPooling2dLayer()

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

Definition at line 2315 of file Network.cpp.

2317 {
2318  return m_Graph->AddLayer<Pooling2dLayer>(pooling2dDescriptor, name);
2319 }

◆ AddPooling3dLayer()

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

Definition at line 2321 of file Network.cpp.

2323 {
2324  return m_Graph->AddLayer<Pooling3dLayer>(pooling3dDescriptor, name);
2325 }

◆ AddPrecompiledLayer()

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

Definition at line 3063 of file Network.cpp.

3067 {
3068  // Method use is for backend users.
3069  PreCompiledLayer* layer;
3070  if (name)
3071  {
3072  layer = m_Graph->AddLayer<PreCompiledLayer>(preCompiledDescriptor, name);
3073  }
3074  else
3075  {
3076  layer = m_Graph->AddLayer<PreCompiledLayer>(preCompiledDescriptor, "pre-compiled");
3077  }
3078 
3079  // Assign the pre-compiled object to layer
3080  // Pass only one compiled network, Arm NN does not handle multiple
3081  // pre-compiled objects in a single pre-compiled layer currently
3082  layer->SetPreCompiledObject(std::move(compiledBlobPtr));
3083 
3084  if (backend.has_value())
3085  {
3086  layer->SetBackendId(backend.value());
3087  }
3088  else if (layer->GetBackendHint().has_value())
3089  {
3090  layer->SetBackendId(layer->GetBackendHint().value());
3091  }
3092 
3093  return layer;
3094 }

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

2675 {
2676  return m_Graph->AddLayer<PreluLayer>(name);
2677 }

◆ AddQLstmLayer()

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

Definition at line 2758 of file Network.cpp.

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

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

2722 {
2723  const auto layer = m_Graph->AddLayer<QuantizedLstmLayer>(name);
2724 
2725  // InputToX weights
2726  layer->m_QuantizedLstmParameters.m_InputToInputWeights =
2727  std::make_shared<ScopedTensorHandle>(params.GetInputToInputWeights());
2728  layer->m_QuantizedLstmParameters.m_InputToForgetWeights =
2729  std::make_shared<ScopedTensorHandle>(params.GetInputToForgetWeights());
2730  layer->m_QuantizedLstmParameters.m_InputToCellWeights =
2731  std::make_shared<ScopedTensorHandle>(params.GetInputToCellWeights());
2732  layer->m_QuantizedLstmParameters.m_InputToOutputWeights =
2733  std::make_shared<ScopedTensorHandle>(params.GetInputToOutputWeights());
2734 
2735  // RecurrentToX weights
2736  layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights =
2737  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToInputWeights());
2738  layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights =
2739  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToForgetWeights());
2740  layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights =
2741  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToCellWeights());
2742  layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights =
2743  std::make_shared<ScopedTensorHandle>(params.GetRecurrentToOutputWeights());
2744 
2745  // Bias
2746  layer->m_QuantizedLstmParameters.m_InputGateBias =
2747  std::make_shared<ScopedTensorHandle>(params.GetInputGateBias());
2748  layer->m_QuantizedLstmParameters.m_ForgetGateBias =
2749  std::make_shared<ScopedTensorHandle>(params.GetForgetGateBias());
2750  layer->m_QuantizedLstmParameters.m_CellBias =
2751  std::make_shared<ScopedTensorHandle>(params.GetCellBias());
2752  layer->m_QuantizedLstmParameters.m_OutputGateBias =
2753  std::make_shared<ScopedTensorHandle>(params.GetOutputGateBias());
2754 
2755  return layer;
2756 }

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

2638 {
2639  return m_Graph->AddLayer<QuantizeLayer>(name);
2640 }

◆ AddRankLayer()

IConnectableLayer * AddRankLayer ( const char *  name = nullptr)

Definition at line 2405 of file Network.cpp.

2406 {
2407  return m_Graph->AddLayer<RankLayer>(name);
2408 }

◆ AddReduceLayer()

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

Definition at line 2410 of file Network.cpp.

2412 {
2413  return m_Graph->AddLayer<ReduceLayer>(reduceDescriptor, name);
2414 }

◆ AddReshapeLayer()

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

Definition at line 2453 of file Network.cpp.

2455 {
2456  return m_Graph->AddLayer<ReshapeLayer>(reshapeDescriptor, name);
2457 }

◆ AddResizeLayer()

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

Definition at line 2416 of file Network.cpp.

2417 {
2418  return m_Graph->AddLayer<ResizeLayer>(resizeDescriptor, name);
2419 }

◆ AddReverseV2Layer()

IConnectableLayer * AddReverseV2Layer ( const char *  name = nullptr)

Definition at line 3053 of file Network.cpp.

3054 {
3055  return m_Graph->AddLayer<ReverseV2Layer>(name);
3056 }

◆ AddScatterNdLayer()

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

Definition at line 3101 of file Network.cpp.

3102 {
3103  return m_Graph->AddLayer<ScatterNdLayer>(desc, name);
3104 }

◆ AddShapeLayer()

IConnectableLayer * AddShapeLayer ( const char *  name = nullptr)

Definition at line 2421 of file Network.cpp.

2422 {
2423  return m_Graph->AddLayer<ShapeLayer>(name);
2424 }

◆ AddSliceLayer()

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

Definition at line 2346 of file Network.cpp.

2347 {
2348  return m_Graph->AddLayer<SliceLayer>(sliceDescriptor, name);
2349 }

◆ AddSoftmaxLayer()

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

Definition at line 2351 of file Network.cpp.

2353 {
2354  return m_Graph->AddLayer<SoftmaxLayer>(softmaxDescriptor, name);
2355 }

◆ AddSpaceToBatchNdLayer()

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

Definition at line 2459 of file Network.cpp.

2461 {
2462  return m_Graph->AddLayer<SpaceToBatchNdLayer>(spaceToBatchNdDescriptor, name);
2463 }

◆ AddSpaceToDepthLayer()

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

Definition at line 2465 of file Network.cpp.

2467 {
2468  return m_Graph->AddLayer<SpaceToDepthLayer>(spaceToDepthDescriptor, name);
2469 }

◆ AddSplitterLayer()

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

Definition at line 2357 of file Network.cpp.

2359 {
2360  return m_Graph->AddLayer<SplitterLayer>(splitterDescriptor, name);
2361 }

◆ AddStackLayer()

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

Definition at line 2707 of file Network.cpp.

2709 {
2710  return m_Graph->AddLayer<StackLayer>(stackDescriptor, name);
2711 }

◆ AddStandInLayer()

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

Definition at line 2714 of file Network.cpp.

2716 {
2717  return m_Graph->AddLayer<StandInLayer>(desc, name);
2718 }

◆ AddStridedSliceLayer()

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

Definition at line 2647 of file Network.cpp.

2649 {
2650  return m_Graph->AddLayer<StridedSliceLayer>(stridedSliceDescriptor, name);
2651 }

◆ AddSubtractionLayer()

IConnectableLayer * AddSubtractionLayer ( const char *  name = nullptr)

Definition at line 2622 of file Network.cpp.

2623 {
2624  return m_Graph->AddLayer<SubtractionLayer>(name);
2625 }

◆ AddSwitchLayer()

IConnectableLayer * AddSwitchLayer ( const char *  name = nullptr)

Definition at line 2669 of file Network.cpp.

2670 {
2671  return m_Graph->AddLayer<SwitchLayer>(name);
2672 }

◆ AddTileLayer()

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

Definition at line 3058 of file Network.cpp.

3059 {
3060  return m_Graph->AddLayer<TileLayer>(desc, name);
3061 }

◆ AddTransposeConvolution2dLayer()

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

Definition at line 2679 of file Network.cpp.

2683 {
2684  if (descriptor.m_BiasEnabled && !biases.has_value())
2685  {
2686  throw InvalidArgumentException("AddTransposeConvolution2dLayer: Biases cannot be empty");
2687  }
2688 
2689  const auto layer = m_Graph->AddLayer<TransposeConvolution2dLayer>(descriptor, name);
2690 
2691  layer->m_Weight = std::make_shared<ScopedTensorHandle>(weights);
2692 
2693  if (descriptor.m_BiasEnabled)
2694  {
2695  layer->m_Bias = std::make_shared<ScopedTensorHandle>(biases.value());
2696  }
2697 
2698  return layer;
2699 }

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

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

◆ AddUnidirectionalSequenceLstmLayer()

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

Definition at line 2906 of file Network.cpp.

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

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

3107 {
3108  for (auto layer : GetGraph())
3109  {
3110  layer->ExecuteStrategy(strategy);
3111  };
3112 }

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

2196 {
2197  m_Graph->Print();
2198  return Status::Success;
2199 }

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