ArmNN
 24.08
INetwork.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
8 #include <armnn/Deprecated.hpp>
10 #include <armnn/IStrategy.hpp>
11 #include <armnn/NetworkFwd.hpp>
12 #include <armnn/Optional.hpp>
13 #include <armnn/TensorFwd.hpp>
14 #include <armnn/Logging.hpp>
16 
17 #include <memory>
18 #include <vector>
19 
20 namespace armnn
21 {
22 /// @brief An input connection slot for a layer.
23 /// The input slot can be connected to an output slot of the preceding layer in the graph.
24 /// Only one connection to the input slot is allowed.
26 {
27 public:
28  virtual const IOutputSlot* GetConnection() const = 0;
29  virtual IOutputSlot* GetConnection() = 0;
30  virtual const IConnectableLayer& GetOwningIConnectableLayer() const = 0;
32  virtual unsigned int GetSlotIndex() const = 0;
33 
34  /// Sets the TensorInfo for this InputSlot. This can be used to override the TensorInfo and if set will be returned
35  /// instead of the TensorInfo for the Connected OutputSlot.
36  virtual void SetTensorInfo(const TensorInfo tensorInfo) = 0;
37  /// Gets the TensorInfo for this InputSlot. If the InputSlot's TensorInfo has not been set then this will get the
38  /// TensorInfo from the Connected TensorInfo.
39  virtual const TensorInfo& GetTensorInfo() const = 0;
40  /// Returns true if this InputSlot either has an overridden TensorInfo for this InputSlot that was set through a
41  /// call to SetTensorInfo() or is Connected to an OutputSlot that has its TensorInfo set.
42  virtual bool IsTensorInfoSet() const = 0;
43  /// Returns true if this InputSlot has an overridden TensorInfo that was set through a call to SetTensorInfo().
44  virtual bool IsTensorInfoOverridden() const = 0;
45 
46 protected:
47  /// Not user deletable.
49 };
50 
51 /// @brief An output connection slot for a layer.
52 /// The output slot may be connected to 1 or more input slots of subsequent layers in the graph.
54 {
55 public:
56  virtual unsigned int GetNumConnections() const = 0;
57  virtual const IInputSlot* GetConnection(unsigned int index) const = 0;
58  virtual IInputSlot* GetConnection(unsigned int outputindex) = 0;
59 
60  virtual void SetTensorInfo(const TensorInfo& tensorInfo) = 0;
61  virtual const TensorInfo& GetTensorInfo() const = 0;
62  virtual bool IsTensorInfoSet() const = 0;
63 
64  virtual int Connect(IInputSlot& destination) = 0;
65  virtual void Disconnect(IInputSlot& slot) = 0;
66 
67  virtual unsigned int CalculateIndexOnOwner() const = 0;
68 
69  virtual LayerGuid GetOwningLayerGuid() const = 0;
70 
71  virtual const IConnectableLayer& GetOwningIConnectableLayer() const = 0;
73 
74 protected:
75  /// Not user deletable.
77 };
78 
79 /// @brief Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
81 {
82 public:
83  /// Returns the name of the layer
84  virtual const char* GetName() const = 0;
85 
86  /// Returns the number of connectable input slots
87  virtual unsigned int GetNumInputSlots() const = 0;
88 
89  /// Returns the number of connectable output slots
90  virtual unsigned int GetNumOutputSlots() const = 0;
91 
92  /// Get a const input slot handle by slot index
93  virtual const IInputSlot& GetInputSlot(unsigned int index) const = 0;
94 
95  /// Get the input slot handle by slot index
96  virtual IInputSlot& GetInputSlot(unsigned int index) = 0;
97 
98  /// Get the const output slot handle by slot index
99  virtual const IOutputSlot& GetOutputSlot(unsigned int index) const = 0;
100 
101  /// Get the output slot handle by slot index
102  virtual IOutputSlot& GetOutputSlot(unsigned int index) = 0;
103 
104  /// Infer the shape of the output(s) based on the provided input shape(s)
105  virtual std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const = 0;
106 
107  /// Returns the unique id of the layer
108  virtual LayerGuid GetGuid() const = 0;
109 
110  /// Apply a visitor to this layer
111  virtual void ExecuteStrategy(IStrategy& strategy) const = 0;
112 
113  /// Provide a hint for the optimizer as to which backend to prefer for this layer.
114  /// By providing a BackendSelectionHint there is no guarantee the input backend supports that layer.
115  /// If IsLayerSupported() returns false with the backend hint, we default to calling IsLayerSupported()
116  /// on the BackendPreferences vector. Use SetBackendId() if we can guarantee a backend supports that
117  /// layer (IsLayerSupported returns true for a specific backend).
118  virtual void BackendSelectionHint(Optional<BackendId> backend) = 0;
119 
120  /// Returns the armnn::LayerType of this layer
121  virtual LayerType GetType() const = 0;
122 
123  /// If the layer has a descriptor return it.
124  /// The base descriptor can then be cast to the correct descriptor class.
125  /// If the layer has no associated descriptor a struct of type NullDescriptor will be returned.
126  /// Note: NullDescriptors can be detected because they return true when
127  /// the BaseDescriptor IsNull function is invoked.
128  virtual const BaseDescriptor& GetParameters() const = 0;
129 
130  /// Set the backend of the IConnectableLayer.
131  /// By using SetBackendId() we guarantee that the input backend supports that
132  /// layer (IsLayerSupported returns true for a specific backend). If there is
133  /// no guarantee the input backend supports that layer use BackendSelectionHint().
134  virtual void SetBackendId(const BackendId& id) = 0;
135 
136  using ConstantTensors = std::vector<std::reference_wrapper<std::shared_ptr<ConstTensorHandle>>>;
137 
138  // Returns ConstantTensors of this Layer if it has any, otherwise returns empty vector.
140 
141  using ImmutableConstantTensors = std::vector<std::reference_wrapper<const std::shared_ptr<ConstTensorHandle>>>;
142 
143  // Returns ConstantTensors of this Layer if it has any, otherwise returns empty vector.
145 
146 protected:
147  /// Objects are not deletable via the handle
149 };
150 
152 {
153  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use ABI stable OptimizerOptionsOpaque instead.", "24.02")
155  : m_ReduceFp32ToFp16(false)
156  , m_Debug(false)
157  , m_DebugToFile(false)
158  , m_ReduceFp32ToBf16(false)
160  , m_ImportEnabled(false)
161  , m_ModelOptions()
162  , m_ProfilingEnabled(false)
163  , m_ExportEnabled(false)
164  , m_AllowExpandedDims(false)
165  {}
166 
167  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use ABI stable OptimizerOptionsOpaque instead.", "24.02")
168  OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16, bool importEnabled,
169  ModelOptions modelOptions = {}, bool exportEnabled = false, bool debugToFile = false)
170  : m_ReduceFp32ToFp16(reduceFp32ToFp16)
171  , m_Debug(debug)
172  , m_DebugToFile(debugToFile)
173  , m_ReduceFp32ToBf16(reduceFp32ToBf16)
175  , m_ImportEnabled(importEnabled)
176  , m_ModelOptions(modelOptions)
177  , m_ProfilingEnabled(false)
178  , m_ExportEnabled(exportEnabled)
179  , m_AllowExpandedDims(false)
180  {
181  }
182 
183  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use ABI stable OptimizerOptionsOpaque instead.", "24.02")
184  OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16 = false,
185  ShapeInferenceMethod shapeInferenceMethod = armnn::ShapeInferenceMethod::ValidateOnly,
186  bool importEnabled = false, ModelOptions modelOptions = {}, bool exportEnabled = false,
187  bool debugToFile = false, bool allowExpandedDims = false)
188  : m_ReduceFp32ToFp16(reduceFp32ToFp16)
189  , m_Debug(debug)
190  , m_DebugToFile(debugToFile)
191  , m_ReduceFp32ToBf16(reduceFp32ToBf16)
192  , m_shapeInferenceMethod(shapeInferenceMethod)
193  , m_ImportEnabled(importEnabled)
194  , m_ModelOptions(modelOptions)
195  , m_ProfilingEnabled(false)
196  , m_ExportEnabled(exportEnabled)
197  , m_AllowExpandedDims(allowExpandedDims)
198  {
199  }
200 
201  const std::string ToString() const
202  {
203  std::stringstream stream;
204  stream << "OptimizerOptions: \n";
205  stream << "\tReduceFp32ToFp16: " << m_ReduceFp32ToFp16 << "\n";
206  stream << "\tReduceFp32ToBf16: " << m_ReduceFp32ToBf16 << "\n";
207  stream << "\tDebug: " << m_Debug << "\n";
208  stream << "\tDebug to file: " << m_DebugToFile << "\n";
209  stream << "\tShapeInferenceMethod: " <<
211  ? "ValidateOnly" : "InferAndValidate") << "\n";
212  stream << "\tImportEnabled: " << m_ImportEnabled << "\n";
213  stream << "\tExportEnabled: " << m_ExportEnabled << "\n";
214  stream << "\tProfilingEnabled: " << m_ProfilingEnabled << "\n";
215  stream << "\tAllowExpandedDims: " << m_AllowExpandedDims << "\n";
216 
217  stream << "\tModelOptions: \n";
218  for (auto optionsGroup : m_ModelOptions)
219  {
220  for (size_t i=0; i < optionsGroup.GetOptionCount(); i++)
221  {
222  const armnn::BackendOptions::BackendOption option = optionsGroup.GetOption(i);
223  stream << "\t\tBackend: " << optionsGroup.GetBackendId() << "\n"
224  << "\t\t\tOption: " << option.GetName() << "\n"
225  << "\t\t\tValue: " << std::string(option.GetValue().ToString()) << "\n";
226  }
227  }
228 
229  return stream.str();
230  }
231 
232  /// Reduces all Fp32 operators in the model to Fp16 for faster processing.
233  /// @Note This feature works best if all operators of the model are in Fp32. ArmNN will add conversion layers
234  /// between layers that weren't in Fp32 in the first place or if the operator is not supported in Fp16.
235  /// The overhead of these conversions can lead to a slower overall performance if too many conversions are
236  /// required.
238 
239  /// Add debug data for easier troubleshooting
240  bool m_Debug;
241 
242  /// Pass debug data to separate output files for easier troubleshooting
244 
245  /// @Note This feature has been replaced by enabling Fast Math in compute library backend options.
246  /// This is currently a placeholder option
248 
249  /// Infer output size when not available
251 
252  /// Enable Import
254 
255  /// Enable Model Options
257 
258  /// Enable profiling dump of the optimizer phase
260 
261  /// Enable Export
263 
264  /// When calculating tensor sizes, dimensions of size == 1 will be ignored
266 };
267 
268 /// ArmNN performs an optimization on each model/network before it gets loaded for execution. OptimizerOptions provides
269 /// a set of features that allows the user to customize this optimization on a per model basis.
271 
273 {
274 public:
278 
279  OptimizerOptionsOpaque(const OptimizerOptions& OptimizerStruct);
280 
282 
283  OptimizerOptionsOpaque(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16, bool importEnabled,
284  ModelOptions modelOptions = {}, bool exportEnabled = false, bool debugToFile = false);
285 
286  OptimizerOptionsOpaque(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16 = false,
288  bool importEnabled = false, ModelOptions modelOptions = {}, bool exportEnabled = false,
289  bool debugToFile = false, bool allowExpandedDims = false);
290 
291  const std::string ToString() const;
292 
293  bool GetProfilingEnabled() const;
294 
295  bool GetImportEnabled() const;
296 
297  bool GetExportEnabled() const;
298 
299  bool GetReduceFp32ToFp16() const;
300 
301  bool GetReduceFp32ToBf16() const;
302 
303  bool GetDebugEnabled() const;
304 
305  bool GetDebugToFileEnabled() const;
306 
307  bool GetAllowExpandedDims() const;
308 
310 
312 
313  void SetImportEnabled(bool ImportState);
314 
315  void SetExportEnabled(bool ExportState);
316 
317  void SetProfilingEnabled(bool ProfilingState);
318 
319  void SetDebugEnabled(bool DebugState);
320 
321  void SetDebugToFileEnabled(bool DebugFileState);
322 
323  void SetReduceFp32ToFp16(bool ReduceFp32ToFp16State);
324 
325  void SetShapeInferenceMethod(armnn::ShapeInferenceMethod ShapeInferenceMethodType);
326 
328 
329  void SetAllowExpandedDims(bool ExpandedDimsAllowed);
330 
331 private:
332 
333  std::unique_ptr<armnn::OptimizerOptionsOpaqueImpl> p_OptimizerOptionsImpl;
334 
335 };
336 
337 class IWorkloadFactory;
338 class NetworkImpl;
339 using INetworkPtr = std::unique_ptr<INetwork, void(*)(INetwork* network)>;
340 using IOptimizedNetworkPtr = std::unique_ptr<IOptimizedNetwork, void(*)(IOptimizedNetwork* network)>;
341 
342 using CompiledBlobDeleter = std::function<void(const void*)>;
343 using CompiledBlobPtr = std::unique_ptr<void, CompiledBlobDeleter>;
344 
345 /// Main network class which provides the interface for building up a neural network.
346 /// This object is subsequently required by the IRuntime::Load() method.
347 class INetwork
348 {
349 public:
350  static INetwork* CreateRaw(const NetworkOptions& networkOptions = {});
351  static INetworkPtr Create(const NetworkOptions& networkOptions = {});
352  static void Destroy(INetwork* network);
353 
354  Status PrintGraph();
355 
356  /// Adds an input layer to the network.
357  /// @param id - User generated id to uniquely identify a particular input. The same id needs to be specified.
358  /// when passing the inputs to the IRuntime::EnqueueWorkload() function.
359  /// @param name - Optional name for the layer.
360  /// @return - Interface for configuring the layer.
361  IConnectableLayer* AddInputLayer(LayerBindingId id, const char* name = nullptr);
362 
363  /// Adds an ArgMinMax layer to the network.
364  /// @param desc - Parameters for the L2 normalization operation.
365  /// @param name - Optional name for the layer.
366  /// @return - Interface for configuring the layer.
368  const char* name = nullptr);
369 
370  /// Adds a cast layer to the network.
371  /// @param name - Optional name for the layer.
372  /// @return - Interface for configuring the layer.
373  IConnectableLayer* AddCastLayer(const char* name = nullptr);
374 
375  /// Add a Comparison layer to the network.
376  /// @param name - Optional name for the layer.
377  /// @param desc - Descriptor for the comparison operation.
378  /// @return - Interface for configuring the layer.
379  IConnectableLayer* AddComparisonLayer(const ComparisonDescriptor& comparisonDescriptor,
380  const char* name = nullptr);
381 
382  /// Adds a concatenation layer to the network.
383  /// @param concatDescriptor - ConcatDescriptor (synonym for OriginsDescriptor) to configure the concatenation
384  /// process. Number of Views must be equal to the number of inputs, and their order
385  /// must match - e.g. first view corresponds to the first input, second view to the
386  /// second input, etc....
387  /// @param name - Optional name for the layer.
388  /// @return - Interface for configuring the layer.
389  IConnectableLayer* AddConcatLayer(const ConcatDescriptor& concatDescriptor,
390  const char* name = nullptr);
391 
392  /// Adds a 2D convolution layer to the network.
393  /// @param convolution2dDescriptor - Description of the 2D convolution layer.
394  /// @param name - Optional name for the layer.
395  /// @return - Interface for configuring the layer.
396  IConnectableLayer* AddConvolution2dLayer(const Convolution2dDescriptor& convolution2dDescriptor,
397  const char* name = nullptr);
398 
399  /// Adds a 3D convolution layer to the network.
400  /// @param convolution3dDescriptor - Description of the 3D convolution layer.
401  /// @param name - Optional name for the layer.
402  /// @return - Interface for configuring the layer.
403  IConnectableLayer* AddConvolution3dLayer(const Convolution3dDescriptor& convolution3dDescriptor,
404  const char* name = nullptr);
405 
406  /// Adds a depth to space layer to the network.
407  /// @param depthToSpaceDescriptor - Parameters for the depth to space operation.
408  /// @param name - Optional name for the layer.
409  /// @return - Interface for configuring the layer.
410  IConnectableLayer* AddDepthToSpaceLayer(const DepthToSpaceDescriptor& depthToSpaceDescriptor,
411  const char* name = nullptr);
412 
413  /// Adds a 2D depthwise convolution layer to the network.
414  /// @param convolution2dDescriptor - Description of the 2D depthwise convolution layer.
415  /// @param name - Optional name for the layer.
416  /// @return - Interface for configuring the layer.
418  const char* name = nullptr);
419 
420  /// Adds a Dequantize layer to the network.
421  /// @return - Interface for configuring the layer.
422  IConnectableLayer* AddDequantizeLayer(const char* name = nullptr);
423 
424  /// Adds a Detection PostProcess layer to the network.
425  /// @param descriptor - Description of the Detection PostProcess layer.
426  /// @param anchors - Tensor for anchors.
427  /// @param name - Optional name for the layer.
428  /// @return - Interface for configuring the layer.
430  const DetectionPostProcessDescriptor& descriptor,
431  const ConstTensor& anchors,
432  const char* name = nullptr);
433 
434  /// Add an ElementwiseBinary layer to the network.
435  /// @param name - Optional name for the layer.
436  /// @param desc - Descriptor for the elementwiseBinary operations.
437  /// @return - Interface for configuring the layer.
438  IConnectableLayer* AddElementwiseBinaryLayer(const ElementwiseBinaryDescriptor& elementwiseBinaryDescriptor,
439  const char* name = nullptr);
440 
441  /// Add an ElementwiseUnary layer to the network.
442  /// @param name - Optional name for the layer.
443  /// @param desc - Descriptor for the elementwiseUnary operations.
444  /// @return - Interface for configuring the layer.
445  IConnectableLayer* AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor& elementwiseUnaryDescriptor,
446  const char* name = nullptr);
447 
448  /// Add an Fill layer to the network.
449  /// @param name - Optional name for the layer.
450  /// @param fillDescriptor - Descriptor for the fill operation.
451  /// @return - Interface for configuring the layer.
452  IConnectableLayer* AddFillLayer(const FillDescriptor& fillDescriptor,
453  const char* name = nullptr);
454 
455 
456  /// Adds a fully connected layer to the network.
457  /// @param fullyConnectedDescriptor - Description of the fully connected layer.
458  /// @return - Interface for configuring the layer.
459  ///
460  /// @note Weights and biases are passed in as inputs. If they are constant tensors you can simply store
461  /// them in a ConstantLayer as seen below. A full example can be found in samples/SimpleSample.cpp.
462  ///
463  /// @code
464  /// // Make sure the IsConstant flag is set on the weightsInfo before passing it to the ConstTensor.
465  /// ConstTensor weights(weightsInfo, weightsData);
466  ///
467  /// // Constant layer that now holds weights data for FullyConnected
468  /// IConnectableLayer* const constantWeightsLayer = myNetwork->AddConstantLayer(weights, "weights");
469  ///
470  /// FullyConnectedDescriptor fullyConnectedDesc;
471  /// IConnectableLayer* const fullyConnectedLayer = myNetwork->AddFullyConnectedLayer(fullyConnectedDesc,
472  /// "fully connected");
473  /// IConnectableLayer* InputLayer = myNetwork->AddInputLayer(0);
474  /// InputLayer->GetOutputSlot(0).Connect(fullyConnectedLayer->GetInputSlot(0));
475  /// constantWeightsLayer->GetOutputSlot(0).Connect(fullyConnectedLayer->GetInputSlot(1));
476  /// @endcode
477  IConnectableLayer* AddFullyConnectedLayer(const FullyConnectedDescriptor& fullyConnectedDescriptor,
478  const char* name = nullptr);
479 
480  /// Adds a Fused layer to the network.
481  /// Method use is for backend users.
482  /// @param fusedDescriptor - FusedDescriptor contains parameters for the Fused layer.
483  /// @param name - Optional name for the layer.
484  /// @return - Interface for configuring the layer.
485  IConnectableLayer* AddFusedLayer(const FusedDescriptor& fusedDescriptor,
486  const char* name = nullptr);
487 
488  /// Adds a permute layer to the network.
489  /// @param permuteDescriptor - PermuteDescriptor to configure the permute.
490  /// @param name - Optional name for the layer.
491  /// @return - Interface for configuring the layer.
492  IConnectableLayer* AddPermuteLayer(const PermuteDescriptor& permuteDescriptor,
493  const char* name = nullptr);
494 
495  /// Adds a batch to space ND layer to the network.
496  /// @param batchToSpaceNdDescriptor - Description of the layer.
497  /// @param name - Optional name for the layer.
498  /// @return - Interface for configuring the layer.
499  IConnectableLayer* AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor& batchToSpaceNdDescriptor,
500  const char* name = nullptr);
501 
502  /// Adds a 2D pooling layer to the network.
503  /// @param pooling2dDescriptor - Pooling2dDescriptor to configure the pooling.
504  /// @param name - Optional name for the layer.
505  /// @return - Interface for configuring the layer.
506  IConnectableLayer* AddPooling2dLayer(const Pooling2dDescriptor& pooling2dDescriptor,
507  const char* name = nullptr);
508 
509  /// Adds a 3D pooling layer to the network.
510  /// @param pooling3dDescriptor - Pooling3dDescriptor to configure the pooling.
511  /// @param name - Optional name for the layer.
512  /// @return - Interface for configuring the layer.
513  IConnectableLayer* AddPooling3dLayer(const Pooling3dDescriptor& pooling3dDescriptor,
514  const char* name = nullptr);
515 
516  /// Adds a Precompiled layer to the network.
517  /// Method use is for backend users.
518  /// @param preCompiledDescriptor - PreCompiledDescriptor contains parameters for the Precompiled layer.
519  /// @param compiledBlobPtr - CompiledBlobPtr pre-compiled object set for the Precompiled layer.
520  /// @param backend - optional BackendId set for the Precompiled layer.
521  /// @return - Interface for configuring the layer.
522  IConnectableLayer* AddPrecompiledLayer(const PreCompiledDescriptor& preCompiledDescriptor,
523  CompiledBlobPtr compiledBlobPtr,
524  const Optional<BackendId>& backend,
525  const char* name = nullptr);
526 
527  /// Adds an activation layer to the network.
528  /// @param activationDescriptor - ActivationDescriptor to configure the activation.
529  /// @param name - Optional name for the layer.
530  /// @return - Interface for configuring the layer.
531  IConnectableLayer* AddActivationLayer(const ActivationDescriptor& activationDescriptor,
532  const char* name = nullptr);
533 
534  /// Adds a normalization layer to the network.
535  /// @param normalizationDescriptor - NormalizationDescriptor to configure the normalization.
536  /// @param name - Optional name for the layer.
537  /// @return - Interface for configuring the layer.
538  IConnectableLayer* AddNormalizationLayer(const NormalizationDescriptor& normalizationDescriptor,
539  const char* name = nullptr);
540 
541  /// Adds a slice layer to the network.
542  /// @param sliceDescriptor - SliceDescriptor to configure the slice operation.
543  /// @param name - Optional name for the layer.
544  /// @return - Interface for configuring the layer.
545  IConnectableLayer* AddSliceLayer(const SliceDescriptor& sliceDescriptor, const char* name = nullptr);
546 
547  /// Adds a softmax layer to the network.
548  /// If the data type is QAsymm8, then the output quantization parameters
549  /// must have a scale of 1/256 and an offset of 0
550  /// @param softmaxDescriptor - SoftmaxDescriptor to configure the softmax.
551  /// @param name - Optional name for the layer.
552  /// @return - Interface for configuring the layer.
553  IConnectableLayer* AddSoftmaxLayer(const SoftmaxDescriptor& softmaxDescriptor,
554  const char* name = nullptr);
555 
556  /// Adds a splitter layer to the network.
557  /// @param splitterDescriptor - ViewsDescriptor to configure the splitting process.
558  /// Number of Views must be equal to the number of outputs,
559  /// and their order must match - e.g. first view corresponds to
560  /// the first output, second view to the second output, etc....
561  /// @param name - Optional name for the layer.
562  /// @return - Interface for configuring the layer.
563  IConnectableLayer* AddSplitterLayer(const ViewsDescriptor& splitterDescriptor,
564  const char* name = nullptr);
565 
566  /// Adds a merge layer to the network.
567  /// @param name - Optional name for the layer.
568  /// @return - Interface for configuring the layer.
569  IConnectableLayer* AddMergeLayer(const char* name = nullptr);
570 
571  /// Adds an addition layer to the network.
572  /// @param name - Optional name for the layer.
573  /// @return - Interface for configuring the layer.
574  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
575  IConnectableLayer* AddAdditionLayer(const char* name = nullptr);
576 
577  /// Adds a multiplication layer to the network.
578  /// @param name - Optional name for the layer.
579  /// @return - Interface for configuring the layer.
580  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
581  IConnectableLayer* AddMultiplicationLayer(const char* name = nullptr);
582 
583  /// Adds a batch normalization layer to the network.
584  /// @param mean - Pre-calculated mean for each channel.
585  /// @param variance - Pre-calculated variance for each channel.
586  /// @param beta - Per-channel additive factor.
587  /// @param gamma - Per-channel multiplicative factor.
588  /// @return - Interface for configuring the layer.
589  /// @param name - Optional name for the layer.
591  const ConstTensor& mean,
592  const ConstTensor& variance,
593  const ConstTensor& beta,
594  const ConstTensor& gamma,
595  const char* name = nullptr);
596 
597  /// Adds a rank layer to the network.
598  /// @param name - Optional name for the layer.
599  /// @return - Interface for configuring the layer.
600  IConnectableLayer* AddRankLayer(const char* name = nullptr);
601 
602  /// Adds a resize layer to the network.
603  /// @param resizeDescriptor - Parameters for the resize operation.
604  /// @param name - Optional name for the layer.
605  /// @return - Interface for configuring the layer.
606  IConnectableLayer* AddResizeLayer(const ResizeDescriptor& resizeDescriptor,
607  const char* name = nullptr);
608 
609  /// Adds a reduce layer to the network.
610  /// @param ReduceDescriptor - Parameters for the reduce operation.
611  /// @param name - Optional name for the layer.
612  /// @return - Interface for configuring the layer.
613  IConnectableLayer* AddReduceLayer(const ReduceDescriptor& reduceDescriptor,
614  const char* name = nullptr);
615 
616  /// Adds an instance normalization layer to the network.
617  /// @param desc - Parameters for the instance normalization operation.
618  /// @param name - Optional name for the layer.
619  /// @return - Interface for configuring the layer.
621  const char* name = nullptr);
622 
623  /// Adds an L2 normalization layer to the network.
624  /// Normalization is performed along dimension 1, but requires a 4d input.
625  /// @param desc - Parameters for the L2 normalization operation.
626  /// @param name - Optional name for the layer.
627  /// @return - Interface for configuring the layer.
629  const char* name = nullptr);
630 
631  /// Adds a log softmax layer to the network.
632  /// @param logSoftmaxDescriptor - LogSoftmaxDescriptor to configure the log softmax.
633  /// @param name - Optional name for the layer.
634  /// @return - Interface for configuring the layer.
635  IConnectableLayer* AddLogSoftmaxLayer(const LogSoftmaxDescriptor& logSoftmaxDescriptor,
636  const char* name = nullptr);
637 
638  /// Adds a layer with no inputs and a single output, which always corresponds to
639  /// the passed in constant tensor.
640  /// @param input - Tensor to be provided as the only output of the layer. The layer will maintain
641  /// its own copy of the tensor data, meaning the memory referenced by @a input can
642  /// be freed or reused after this function is called.
643  /// @param name - Optional name for the layer.
644  /// @return - Interface for configuring the layer.
646  const char* name = nullptr);
647 
648  /// Adds a reshape layer to the network.
649  /// @param reshapeDescriptor - Parameters for the reshape operation.
650  /// @param name - Optional name for the layer.
651  /// @return - Interface for configuring the layer.
652  IConnectableLayer* AddReshapeLayer(const ReshapeDescriptor& reshapeDescriptor,
653  const char* name = nullptr);
654 
655  /// Adds a shape layer to the network.
656  /// @param name - Optional name for the layer.
657  /// @return - Interface for configuring the layer.
658  IConnectableLayer* AddShapeLayer(const char* name = nullptr);
659 
660  /// Adds a space to batch layer to the network.
661  /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation.
662  /// @param name - Optional name for the layer.
663  /// @return - Interface for configuring the layer.
664  IConnectableLayer* AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor,
665  const char* name = nullptr);
666 
667  /// Adds a space to depth layer to the network.
668  /// @param spaceToDepthDescriptor - Parameters for the space to depth operation.
669  /// @param name - Optional name for the layer.
670  /// @return - Interface for configuring the layer.
671  IConnectableLayer* AddSpaceToDepthLayer(const SpaceToDepthDescriptor& spaceToDepthDescriptor,
672  const char* name = nullptr);
673 
674  /// Adds a floor layer to the network.
675  /// @param name - Optional name for the layer.
676  /// @return - Interface for configuring the layer.
677  IConnectableLayer* AddFloorLayer(const char* name = nullptr);
678 
679  /// Adds an output layer to the network.
680  /// @param id - User generated id to uniquely identify a particular output. The same id needs to be specified
681  /// when passing the outputs to the IRuntime::EnqueueWorkload() function.
682  /// @param name - Optional name for the layer.
683  /// @return - Interface for configuring the layer.
684  IConnectableLayer* AddOutputLayer(LayerBindingId id, const char* name = nullptr);
685 
686  /// Add a Lstm layer to the network
687  /// @param descriptor - Parameters for the Lstm operation
688  /// @param params - Weights and biases for the LSTM cell
689  /// @param name - Optional name for the layer
690  /// @return - Interface for configuring the layer.
691  IConnectableLayer* AddLstmLayer(const LstmDescriptor& descriptor,
692  const LstmInputParams& params,
693  const char* name = nullptr);
694 
695  /// Adds a division layer to the network.
696  /// @param name - Optional name for the layer.
697  /// @return - Interface for configuring the layer.
698  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
699  IConnectableLayer* AddDivisionLayer(const char* name = nullptr);
700 
701  /// Adds a subtraction layer to the network.
702  /// @param name - Optional name for the layer.
703  /// @return - Interface for configuring the layer.
704  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
705  IConnectableLayer* AddSubtractionLayer(const char* name = nullptr);
706 
707  /// Add a Maximum layer to the network.
708  /// @param name - Optional name for the layer.
709  /// @return - Interface for configuring the layer.
710  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
711  IConnectableLayer* AddMaximumLayer(const char* name = nullptr);
712 
713  /// Add a Mean layer to the network.
714  /// @param meanDescriptor - Parameters for the mean operation.
715  /// @param name - Optional name for the layer.
716  /// @return - Interface for configuring the layer.
717  IConnectableLayer* AddMeanLayer(const MeanDescriptor& meanDescriptor, const char* name = nullptr);
718 
719  /// Adds a fully pad layer to the network.
720  /// @param paddings - n by 2 tensor, where n is the rank of the input tensor,
721  /// such that paddings[i,0] indicates the amount of padding to add in front of dimonsion i, and
722  /// paddings[i,1] indicates the amount of padding to add after the end of dimension i
723  /// @param name - Optional name for the layer.
724  /// @return - Interface for configuring the layer.
725  IConnectableLayer* AddPadLayer(const PadDescriptor& padDescriptor,
726  const char* name = nullptr);
727 
728  /// Add a quantize layer to the network
729  ///@param name - Optional name for the layer.
730  /// @return - Interface for configuring the layer.
731  IConnectableLayer* AddQuantizeLayer(const char* name = nullptr);
732 
733  /// Adds a strided slice layer to the network.
734  /// @param StridedSliceDescriptor - Parameters for the strided slice operation.
735  /// @param name - Optional name for the layer.
736  /// @return - Interface for configuring the layer.
737  IConnectableLayer* AddStridedSliceLayer(const StridedSliceDescriptor& stridedSliceDescriptor,
738  const char* name = nullptr);
739 
740  /// Add a Minimum layer to the network.
741  /// @param name - Optional name for the layer.
742  /// @return - Interface for configuring the layer.
743  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
744  IConnectableLayer* AddMinimumLayer(const char* name = nullptr);
745 
746  /// Add Gather layer to the network.
747  /// @param descriptor - Description of the gather layer.
748  /// @param name - Optional name for the layer.
749  /// @return - Interface for configuring the layer.
751  const char* name = nullptr);
752 
753  /// Add GatherNd layer to the network.
754  /// @param name - Optional name for the layer.
755  /// @return - Interface for configuring the layer.
756  IConnectableLayer* AddGatherNdLayer(const char* name = nullptr);
757 
758  /// Adds a switch layer to the network.
759  /// @param name - Optional name for the layer.
760  /// @return - Interface for configuring the layer.
761  IConnectableLayer* AddSwitchLayer(const char* name = nullptr);
762 
763  /// Adds a PReLU layer to the network.
764  /// @param name - Optional name for the layer.
765  /// @return - Interface for configuring the layer.
766  IConnectableLayer* AddPreluLayer(const char* name = nullptr);
767 
768  /// Adds a 2D transpose convolution layer to the network.
769  /// @param descriptor - Description of the 2D transpose convolution layer.
770  /// @param weights - Tensor for the weights data.
771  /// @param biases - Optional tensor for the bias data.
772  /// @param name - Optional name for the layer.
773  /// @return - Interface for configuring the layer.
775  const ConstTensor& weights,
776  const Optional<ConstTensor>& biases,
777  const char* name = nullptr);
778 
779  /// Adds a transpose layer to the network.
780  /// @param transposeDescriptor - TransposeDescriptor to configure the transpose.
781  /// @param name - Optional name for the layer.
782  /// @return - Interface for configuring the layer.
783  IConnectableLayer* AddTransposeLayer(const TransposeDescriptor& transposeDescriptor,
784  const char* name = nullptr);
785 
786  /// Adds a stack layer to the network.
787  /// @param descriptor - Description of the stack layer.
788  /// @param name - Optional name for the layer.
789  /// @return - Interface for configuring the layer.
791  const char* name = nullptr);
792 
793  /// Add a stand-in layer for a type unknown to the Arm NN framework.
794  /// Note: Due to the nature of this layer, no validation can be performed by the framework.
795  /// Furthermore, Any model containing this layer cannot make use of dynamic tensors since the
796  /// tensor sizes cannot be inferred.
797  /// @descriptor - Descriptor for the StandIn layer.
798  /// @return - Interface for configuring the layer.
800  const char* name = nullptr);
801 
802  /// Add a QuantizedLstm layer to the network
803  /// @param params - The weights and biases for the Quantized LSTM cell
804  /// @param name - Optional name for the layer
805  /// @return - Interface for configuring the layer.
807  const char* name = nullptr);
808 
809  /// Add a QLstm layer to the network
810  /// @param descriptor - Parameters for the QLstm operation
811  /// @param params - Weights and biases for the layer
812  /// @param name - Optional name for the layer
813  /// @return - Interface for configuring the layer.
815  const LstmInputParams& params,
816  const char* name = nullptr);
817 
818  /// Adds a Logical Binary layer to the network.
819  /// @param descriptor - Description of the Logical Binary layer.
820  /// @param name - Optional name for the layer.
821  /// @return - Interface for configuring the layer.
823  const char* name = nullptr);
824 
825  /// Add a UnidirectionalSequenceLstm layer to the network
826  /// @param descriptor - Parameters for the UnidirectionalSequenceLstm operation
827  /// @param params - Weights and biases for the UnidirectionalSequenceLstm
828  /// @param name - Optional name for the layer
829  /// @return - Interface for configuring the layer.
831  const LstmInputParams& params,
832  const char* name = nullptr);
833 
834  /// Add a ChannelShuffle layer to the network
835  /// @param descriptor - Parameters for the ChannelShuffle operation
836  /// @param name - Optional name for the layer
837  /// @return - Interface for configuring the layer
839  const char* name = nullptr);
840 
841  /// Add a BatchMatMul layer to the network
842  /// @param descriptor - Parameters for the BatchMatMul operation
843  /// @param name - Optional name for the layer
844  /// @return - Interface for configuring the layer
846  const char* name = nullptr);
847 
848  /// Add a ReverseV2 layer to the network
849  /// @param name - Optional name for the layer
850  /// @return - Interface for configuring the layer
851  IConnectableLayer* AddReverseV2Layer(const char* name = nullptr);
852 
853  /// Add a Tile layer to the network
854  /// @param descriptor - Parameters for the Tile operation
855  /// @param name - Optional name for the layer
856  /// @return - Interface for configuring the layer
857  IConnectableLayer* AddTileLayer(const TileDescriptor& descriptor,
858  const char* name = nullptr);
859 
860  /// Add a BroadcastTo layer to the network
861  /// @param descriptor - Parameters for the BroadcastTo operation
862  /// @param name - Optional name for the layer
863  /// @return - Interface for configuring the layer
865  const char* name = nullptr);
866 
867  /// Add a ScatterNd layer to the network
868  /// @param descriptor - Parameters for the ScatterNd operation
869  /// @param name - Optional name for the layer
870  /// @return - Interface for configuring the layer
872  const char* name = nullptr);
873 
874  void ExecuteStrategy(IStrategy& strategy) const;
875 
876 protected:
877  ~INetwork();
878 
879  friend void VisitLayersTopologically(const INetwork* inputNetwork, IStrategy& strategy);
881  friend TensorInfo GetInputTensorInfo(const INetwork* network);
882  friend IOptimizedNetworkPtr Optimize(const INetwork& network,
883  const std::vector<BackendId>& backendPreferences,
884  const IDeviceSpec& deviceSpec,
885  const OptimizerOptions& options,
886  Optional<std::vector<std::string>&> messages);
887  friend IOptimizedNetworkPtr Optimize(const INetwork& network,
888  const std::vector<BackendId>& backendPreferences,
889  const IDeviceSpec& deviceSpec,
890  const OptimizerOptionsOpaque& options,
891  Optional<std::vector<std::string>&> messages);
892 
893  INetwork(NetworkOptions networkOptions = {});
894 
895  std::unique_ptr<NetworkImpl> pNetworkImpl;
896 };
897 
898 namespace experimental
899 {
900 class AsyncNetworkImpl;
901 class WorkingMemHandle;
902 }
903 
904 struct BackendSettings;
905 struct OptimizationResult;
906 class OptimizedNetworkImpl;
907 class IProfiler;
909 {
910 public:
911  static void Destroy(IOptimizedNetwork* network);
912 
913  Status PrintGraph();
914  Status SerializeToDot(std::ostream& stream) const;
915 
916  arm::pipe::ProfilingGuid GetGuid() const;
917 
918  size_t GetNumInputs() const;
919  size_t GetNumOutputs() const;
920 
921  void ExecuteStrategy(IStrategy& strategy) const;
922 
923  /// Creates a copy of the IOptimizedNetwork. The IOptimizedNetwork will not be reoptimized,
924  /// the provided ModelOptions will only be used when creating a LoadedNetwork.
925  IOptimizedNetwork(const IOptimizedNetwork& other, const ModelOptions& modelOptions);
926  IOptimizedNetwork(std::unique_ptr<Graph> graph);
927  IOptimizedNetwork(std::unique_ptr<OptimizedNetworkImpl> impl);
929 
930  const std::shared_ptr<IProfiler>& GetProfiler() const;
931 
932 protected:
933  friend class LoadedNetwork;
934 
937 
938  friend Graph& GetGraphForTesting(IOptimizedNetwork* optNetPtr);
940  friend IOptimizedNetworkPtr Optimize(const INetwork& inNetwork,
941  const std::vector<BackendId>& backendPreferences,
942  const IDeviceSpec& deviceSpec,
943  const OptimizerOptionsOpaque& options,
944  Optional<std::vector<std::string>&> messages);
945  friend IOptimizedNetworkPtr Optimize(const Graph& inGraph,
946  const std::vector<BackendId>& backendPreferences,
947  const IDeviceSpec& deviceSpec,
948  const OptimizerOptionsOpaque& options,
949  Optional<std::vector<std::string>&> messages);
950 
951  IOptimizedNetwork(std::unique_ptr<Graph> graph, const ModelOptions& modelOptions);
952 
953  std::unique_ptr<OptimizedNetworkImpl> pOptimizedNetworkImpl;
954 };
955 
956 /// Create an optimized version of the network
957 /// @param network INetwork description of the network to be optimized.
958 /// @param backendPreferences The choice of the backend ordered by user preferences.
959 /// @param deviceSpec DeviceSpec object as queried from the runtime. See IRuntime::GetDeviceSpec()
960 /// @param messages If there are failures or warnings a string describing same will be added to the vector
961 /// @param options OptimizerOptions object with optimizer configuration options
962 /// @return An IOptimizedNetworkPtr interface to the optimized network, throws an exception derived from
963 /// armnn::Exception if process fails.
964 
965 IOptimizedNetworkPtr Optimize(const INetwork& network,
966  const std::vector<BackendId>& backendPreferences,
967  const IDeviceSpec& deviceSpec,
969  Optional<std::vector<std::string>&> messages = EmptyOptional());
970 
971 /// Create an optimized version of the network
972 /// @param inGraph Graph to be optimized.
973 /// @param backendPreferences The choice of the backend ordered by user preferences.
974 /// @param deviceSpec DeviceSpec object as queried from the runtime. See IRuntime::GetDeviceSpec()
975 /// @param messages If there are failures or warnings a string describing same will be added to the vector
976 /// @param options OptimizerOptions object with optimizer configuration options
977 /// @return An IOptimizedNetworkPtr interface to the optimized network, throws an exception derived from
978 /// armnn::Exception if process fails.
979 
980 IOptimizedNetworkPtr Optimize(const Graph& inGraph,
981  const std::vector<BackendId>& backendPreferences,
982  const IDeviceSpec& deviceSpec,
983  const OptimizerOptionsOpaque& options,
984  Optional<std::vector<std::string>&> messages = EmptyOptional());
985 
986 /// Accept legacy OptimizerOptions
987 IOptimizedNetworkPtr Optimize(const Graph& inGraph,
988  const std::vector<BackendId>& backendPreferences,
989  const IDeviceSpec& deviceSpec,
990  const OptimizerOptions& options,
991  Optional<std::vector<std::string>&> messages = EmptyOptional());
992 
993 /// Accept legacy OptimizerOptions
994 IOptimizedNetworkPtr Optimize(const INetwork& network,
995  const std::vector<BackendId>& backendPreferences,
996  const IDeviceSpec& deviceSpec,
997  const OptimizerOptions& options,
998  Optional<std::vector<std::string>&> messages = EmptyOptional());
999 
1000 } //namespace armnn
armnn::INetwork::AddReshapeLayer
IConnectableLayer * AddReshapeLayer(const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
Adds a reshape layer to the network.
Definition: Network.cpp:474
armnn::BatchNormalizationDescriptor
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
Definition: Descriptors.hpp:828
armnn::INetworkPtr
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:339
armnn::INetwork::AddReverseV2Layer
IConnectableLayer * AddReverseV2Layer(const char *name=nullptr)
Add a ReverseV2 layer to the network.
Definition: Network.cpp:649
armnn::IOptimizedNetworkPtr
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:340
armnn::IOptimizedNetwork::ExecuteStrategy
void ExecuteStrategy(IStrategy &strategy) const
Definition: Network.cpp:3135
armnn::IConnectableLayer::SetBackendId
virtual void SetBackendId(const BackendId &id)=0
Set the backend of the IConnectableLayer.
armnn::OptimizerOptionsOpaque::SetExportEnabled
void SetExportEnabled(bool ExportState)
Definition: Network.cpp:116
armnn::INetwork::AddConstantLayer
IConnectableLayer * AddConstantLayer(const ConstTensor &input, const char *name=nullptr)
Adds a layer with no inputs and a single output, which always corresponds to the passed in constant t...
Definition: Network.cpp:468
armnn::INetwork::ExecuteStrategy
void ExecuteStrategy(IStrategy &strategy) const
Definition: Network.cpp:672
armnn::ViewsDescriptor
A ViewsDescriptor for the SplitterLayer.
Definition: Descriptors.hpp:244
armnn::IOptimizedNetwork::GetProfiler
const std::shared_ptr< IProfiler > & GetProfiler() const
Definition: Network.cpp:721
armnn::ActivationDescriptor
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:36
armnn::INetwork::AddQLstmLayer
IConnectableLayer * AddQLstmLayer(const QLstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)
Add a QLstm layer to the network.
Definition: Network.cpp:616
armnn::FullyConnectedDescriptor
A FullyConnectedDescriptor for the FullyConnectedLayer.
Definition: Descriptors.hpp:507
armnn::OptimizerOptions::ToString
const std::string ToString() const
Definition: INetwork.hpp:201
armnn::INetwork::AddCastLayer
IConnectableLayer * AddCastLayer(const char *name=nullptr)
Adds a cast layer to the network.
Definition: Network.cpp:253
armnn::INetwork::AddReduceLayer
IConnectableLayer * AddReduceLayer(const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)
Adds a reduce layer to the network.
Definition: Network.cpp:444
armnn::INetwork::AddMaximumLayer
IConnectableLayer * AddMaximumLayer(const char *name=nullptr)
Add a Maximum layer to the network.
Definition: Network.cpp:522
armnn::OptimizerOptions::m_ImportEnabled
bool m_ImportEnabled
Enable Import.
Definition: INetwork.hpp:253
armnn::QLstmDescriptor
A QLstmDescriptor for the QLstmLayer.
Definition: Descriptors.hpp:1380
armnn::Optional
Definition: Optional.hpp:270
armnn::IConnectableLayer::GetNumInputSlots
virtual unsigned int GetNumInputSlots() const =0
Returns the number of connectable input slots.
armnn::INetwork::AddAdditionLayer
IConnectableLayer * AddAdditionLayer(const char *name=nullptr)
Adds an addition layer to the network.
Definition: Network.cpp:409
armnn::BackendOptions::BackendOption::GetName
std::string GetName() const
Definition: BackendOptions.hpp:251
armnn::OptimizerOptionsOpaque::operator=
OptimizerOptionsOpaque & operator=(OptimizerOptionsOpaque other)
Definition: Network.cpp:96
armnn::INetwork::AddSliceLayer
IConnectableLayer * AddSliceLayer(const SliceDescriptor &sliceDescriptor, const char *name=nullptr)
Adds a slice layer to the network.
Definition: Network.cpp:388
armnn::BackendOptions::BackendOption::GetValue
Var GetValue() const
Definition: BackendOptions.hpp:252
armnn::Pooling3dDescriptor
A Pooling3dDescriptor for the Pooling3dLayer.
Definition: Descriptors.hpp:431
armnn::ResizeDescriptor
A ResizeDescriptor for the ResizeLayer.
Definition: Descriptors.hpp:985
armnn::IInputSlot::IsTensorInfoOverridden
virtual bool IsTensorInfoOverridden() const =0
Returns true if this InputSlot has an overridden TensorInfo that was set through a call to SetTensorI...
armnn::ArgMinMaxDescriptor
An ArgMinMaxDescriptor for ArgMinMaxLayer.
Definition: Descriptors.hpp:67
armnn::IConnectableLayer::GetName
virtual const char * GetName() const =0
Returns the name of the layer.
armnn::InstanceNormalizationDescriptor
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
Definition: Descriptors.hpp:847
armnn::IConnectableLayer::GetParameters
virtual const BaseDescriptor & GetParameters() const =0
If the layer has a descriptor return it.
armnn::GatherDescriptor
A GatherDescriptor for the GatherLayer.
Definition: Descriptors.hpp:965
armnn::INetwork::AddMeanLayer
IConnectableLayer * AddMeanLayer(const MeanDescriptor &meanDescriptor, const char *name=nullptr)
Add a Mean layer to the network.
Definition: Network.cpp:529
armnn::INetwork::AddDequantizeLayer
IConnectableLayer * AddDequantizeLayer(const char *name=nullptr)
Adds a Dequantize layer to the network.
Definition: Network.cpp:300
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::IOptimizedNetwork::GetNumInputs
size_t GetNumInputs() const
Definition: Network.cpp:731
armnn::INetwork::AddTileLayer
IConnectableLayer * AddTileLayer(const TileDescriptor &descriptor, const char *name=nullptr)
Add a Tile layer to the network.
Definition: Network.cpp:654
armnn::L2NormalizationDescriptor
A L2NormalizationDescriptor for the L2NormalizationLayer.
Definition: Descriptors.hpp:809
armnn::OptimizerOptionsOpaque::SetReduceFp32ToFp16
void SetReduceFp32ToFp16(bool ReduceFp32ToFp16State)
Definition: Network.cpp:136
armnn::INetwork::AddSpaceToBatchNdLayer
IConnectableLayer * AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)
Adds a space to batch layer to the network.
Definition: Network.cpp:480
armnn::INetwork::AddL2NormalizationLayer
IConnectableLayer * AddL2NormalizationLayer(const L2NormalizationDescriptor &desc, const char *name=nullptr)
Adds an L2 normalization layer to the network.
Definition: Network.cpp:456
armnn::IOutputSlot::Disconnect
virtual void Disconnect(IInputSlot &slot)=0
armnn::IOptimizedNetwork::SerializeToDot
Status SerializeToDot(std::ostream &stream) const
Definition: Network.cpp:716
armnn::NormalizationDescriptor
A NormalizationDescriptor for the NormalizationLayer.
Definition: Descriptors.hpp:769
armnn::IOptimizedNetwork::GetGuid
arm::pipe::ProfilingGuid GetGuid() const
Definition: Network.cpp:726
armnn::OptimizerOptionsOpaque::GetExportEnabled
bool GetExportEnabled() const
Definition: Network.cpp:166
armnn::IConnectableLayer::GetGuid
virtual LayerGuid GetGuid() const =0
Returns the unique id of the layer.
Deprecated.hpp
armnn::INetwork::AddComparisonLayer
IConnectableLayer * AddComparisonLayer(const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr)
Add a Comparison layer to the network.
Definition: Network.cpp:258
armnn::OptimizerOptionsOpaque::~OptimizerOptionsOpaque
~OptimizerOptionsOpaque()
armnn::IOptimizedNetwork::PrintGraph
Status PrintGraph()
Definition: Network.cpp:711
armnn::ChannelShuffleDescriptor
A ChannelShuffleDescriptor for the ChannelShuffle operator.
Definition: Descriptors.hpp:1562
armnn::IInputSlot::GetOwningIConnectableLayer
virtual const IConnectableLayer & GetOwningIConnectableLayer() const =0
armnn::INetwork::AddFullyConnectedLayer
IConnectableLayer * AddFullyConnectedLayer(const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)
Adds a fully connected layer to the network.
Definition: Network.cpp:332
armnn::IOptimizedNetwork
Definition: INetwork.hpp:908
armnn::LoadedNetwork
Definition: LoadedNetwork.hpp:42
armnn::IConnectableLayer::ConstantTensors
std::vector< std::reference_wrapper< std::shared_ptr< ConstTensorHandle > >> ConstantTensors
Definition: INetwork.hpp:136
armnn::INetwork::AddBatchMatMulLayer
IConnectableLayer * AddBatchMatMulLayer(const BatchMatMulDescriptor &descriptor, const char *name=nullptr)
Add a BatchMatMul layer to the network.
Definition: Network.cpp:643
armnn::BackendOptions::BackendOption
Definition: BackendOptions.hpp:215
armnn::OptimizerOptionsOpaque::GetModelOptions
armnn::ModelOptions GetModelOptions() const
Definition: Network.cpp:196
armnn::INetwork::AddLogSoftmaxLayer
IConnectableLayer * AddLogSoftmaxLayer(const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)
Adds a log softmax layer to the network.
Definition: Network.cpp:462
armnn::INetwork::TestConnectionPreservation
friend class TestConnectionPreservation
Definition: INetwork.hpp:880
armnn::OptimizerOptionsOpaque::GetImportEnabled
bool GetImportEnabled() const
Definition: Network.cpp:161
armnn::StackDescriptor
A StackDescriptor for the StackLayer.
Definition: Descriptors.hpp:1251
armnn::IConnectableLayer::InferOutputShapes
virtual std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const =0
Infer the shape of the output(s) based on the provided input shape(s)
armnn::IOutputSlot::GetTensorInfo
virtual const TensorInfo & GetTensorInfo() const =0
armnn::OptimizerOptionsOpaque::GetReduceFp32ToBf16
bool GetReduceFp32ToBf16() const
Definition: Network.cpp:176
armnn::INetwork::CreateRaw
static INetwork * CreateRaw(const NetworkOptions &networkOptions={})
Definition: Network.cpp:677
armnn::OptimizerOptions::m_ReduceFp32ToFp16
bool m_ReduceFp32ToFp16
Reduces all Fp32 operators in the model to Fp16 for faster processing.
Definition: INetwork.hpp:237
armnn::IStrategy
Definition: IStrategy.hpp:16
armnn::INetwork::AddPreluLayer
IConnectableLayer * AddPreluLayer(const char *name=nullptr)
Adds a PReLU layer to the network.
Definition: Network.cpp:574
armnn::OptimizerOptionsOpaque::GetReduceFp32ToFp16
bool GetReduceFp32ToFp16() const
Definition: Network.cpp:171
armnn::IOptimizedNetwork::GetGraphForTesting
friend Graph & GetGraphForTesting(IOptimizedNetwork *optNetPtr)
Definition: TestUtils.cpp:49
armnn::INetwork::AddOutputLayer
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr)
Adds an output layer to the network.
Definition: Network.cpp:496
armnn::IConnectableLayer::GetNumOutputSlots
virtual unsigned int GetNumOutputSlots() const =0
Returns the number of connectable output slots.
armnn::INetwork::AddStridedSliceLayer
IConnectableLayer * AddStridedSliceLayer(const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)
Adds a strided slice layer to the network.
Definition: Network.cpp:545
armnn::INetwork::AddFusedLayer
IConnectableLayer * AddFusedLayer(const FusedDescriptor &fusedDescriptor, const char *name=nullptr)
Adds a Fused layer to the network.
Definition: Network.cpp:338
armnn::INetwork::AddSoftmaxLayer
IConnectableLayer * AddSoftmaxLayer(const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
Adds a softmax layer to the network.
Definition: Network.cpp:392
armnn::INetwork::AddPermuteLayer
IConnectableLayer * AddPermuteLayer(const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
Adds a permute layer to the network.
Definition: Network.cpp:344
armnn::INetwork::VisitLayersTopologically
friend void VisitLayersTopologically(const INetwork *inputNetwork, IStrategy &strategy)
armnn::INetwork::AddTransposeLayer
IConnectableLayer * AddTransposeLayer(const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)
Adds a transpose layer to the network.
Definition: Network.cpp:587
armnn::OptimizerOptionsOpaque::GetShapeInferenceMethod
armnn::ShapeInferenceMethod GetShapeInferenceMethod() const
Definition: Network.cpp:201
armnn::IConnectableLayer::ImmutableConstantTensors
std::vector< std::reference_wrapper< const std::shared_ptr< ConstTensorHandle > >> ImmutableConstantTensors
Definition: INetwork.hpp:141
armnn::OptimizerOptionsOpaque::SetShapeInferenceMethod
void SetShapeInferenceMethod(armnn::ShapeInferenceMethod ShapeInferenceMethodType)
Definition: Network.cpp:141
armnn::ElementwiseBinaryDescriptor
A ElementwiseBinaryDescriptor for the ElementwiseBinaryLayer.
Definition: Descriptors.hpp:109
armnn::INetwork::AddStackLayer
IConnectableLayer * AddStackLayer(const StackDescriptor &descriptor, const char *name=nullptr)
Adds a stack layer to the network.
Definition: Network.cpp:598
armnn::OptimizerOptions::m_shapeInferenceMethod
ShapeInferenceMethod m_shapeInferenceMethod
Infer output size when not available.
Definition: INetwork.hpp:250
armnn::INetwork::AddPooling3dLayer
IConnectableLayer * AddPooling3dLayer(const Pooling3dDescriptor &pooling3dDescriptor, const char *name=nullptr)
Adds a 3D pooling layer to the network.
Definition: Network.cpp:362
TensorFwd.hpp
Optional.hpp
armnn::NetworkOptions
std::vector< BackendOptions > NetworkOptions
Definition: BackendOptions.hpp:16
armnn::IOutputSlot
An output connection slot for a layer.
Definition: INetwork.hpp:53
armnn::FusedDescriptor
A FusedDescriptor for the FusedLayer.
Definition: Descriptors.hpp:944
armnn::INetwork::AddUnidirectionalSequenceLstmLayer
IConnectableLayer * AddUnidirectionalSequenceLstmLayer(const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)
Add a UnidirectionalSequenceLstm layer to the network.
Definition: Network.cpp:629
armnn::INetwork::AddDepthToSpaceLayer
IConnectableLayer * AddDepthToSpaceLayer(const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)
Adds a depth to space layer to the network.
Definition: Network.cpp:285
armnn::INetwork::AddMergeLayer
IConnectableLayer * AddMergeLayer(const char *name=nullptr)
Adds a merge layer to the network.
Definition: Network.cpp:404
armnn::IOutputSlot::GetConnection
virtual const IInputSlot * GetConnection(unsigned int index) const =0
armnn::BackendOptions::Var::ToString
std::string ToString()
Definition: BackendOptions.hpp:124
armnn::INetwork::AddSpaceToDepthLayer
IConnectableLayer * AddSpaceToDepthLayer(const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)
Adds a space to depth layer to the network.
Definition: Network.cpp:486
armnn::OptimizerOptionsOpaque::AddModelOption
void AddModelOption(armnn::BackendOptions)
Definition: Network.cpp:151
armnn::OptimizerOptionsOpaque::OptimizerOptionsOpaque
OptimizerOptionsOpaque()
Definition: Network.cpp:49
armnn::INetwork::AddPrecompiledLayer
IConnectableLayer * AddPrecompiledLayer(const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
Adds a Precompiled layer to the network.
Definition: Network.cpp:368
Logging.hpp
armnn::PadDescriptor
A PadDescriptor for the PadLayer.
Definition: Descriptors.hpp:1196
armnn::IOutputSlot::SetTensorInfo
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
armnn::TransposeDescriptor
A TransposeDescriptor for the TransposeLayer.
Definition: Descriptors.hpp:1490
armnn::IInputSlot::~IInputSlot
~IInputSlot()
Not user deletable.
Definition: INetwork.hpp:48
armnn::EmptyOptional
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition: Optional.hpp:32
armnn::SliceDescriptor
A SliceDescriptor for the SliceLayer.
Definition: Descriptors.hpp:1228
armnn::INetwork::AddSplitterLayer
IConnectableLayer * AddSplitterLayer(const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
Adds a splitter layer to the network.
Definition: Network.cpp:398
armnn::INetwork::AddShapeLayer
IConnectableLayer * AddShapeLayer(const char *name=nullptr)
Adds a shape layer to the network.
Definition: Network.cpp:593
armnn::INetwork::AddBatchNormalizationLayer
IConnectableLayer * AddBatchNormalizationLayer(const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr)
Adds a batch normalization layer to the network.
Definition: Network.cpp:423
armnn::ReshapeDescriptor
A ReshapeDescriptor for the ReshapeLayer.
Definition: Descriptors.hpp:1023
armnn::IWorkloadFactory
Definition: WorkloadFactory.hpp:22
armnn::OptimizerOptions::m_Debug
bool m_Debug
Add debug data for easier troubleshooting.
Definition: INetwork.hpp:240
armnn::LayerBindingId
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
Definition: Types.hpp:309
armnn::OptimizerOptions::m_ExportEnabled
bool m_ExportEnabled
Enable Export.
Definition: INetwork.hpp:262
armnn::INetwork::AddMinimumLayer
IConnectableLayer * AddMinimumLayer(const char *name=nullptr)
Add a Minimum layer to the network.
Definition: Network.cpp:551
armnn::INetwork::AddConvolution2dLayer
IConnectableLayer * AddConvolution2dLayer(const Convolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
Adds a 2D convolution layer to the network.
Definition: Network.cpp:272
armnn::INetwork::AddDetectionPostProcessLayer
IConnectableLayer * AddDetectionPostProcessLayer(const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)
Adds a Detection PostProcess layer to the network.
Definition: Network.cpp:306
armnn::PermuteDescriptor
A PermuteDescriptor for the PermuteLayer.
Definition: Descriptors.hpp:149
armnn::BatchMatMulDescriptor
A BatchMatMulDescriptor for the BatchMatMul operator.
Definition: Descriptors.hpp:1584
armnn::INetwork::AddLogicalBinaryLayer
IConnectableLayer * AddLogicalBinaryLayer(const LogicalBinaryDescriptor &descriptor, const char *name=nullptr)
Adds a Logical Binary layer to the network.
Definition: Network.cpp:623
armnn::IOutputSlot::GetOwningLayerGuid
virtual LayerGuid GetOwningLayerGuid() const =0
DescriptorsFwd.hpp
armnn::IConnectableLayer::GetType
virtual LayerType GetType() const =0
Returns the armnn::LayerType of this layer.
armnn::INetwork::AddDivisionLayer
IConnectableLayer * AddDivisionLayer(const char *name=nullptr)
Adds a division layer to the network.
Definition: Network.cpp:508
armnn::IInputSlot::IsTensorInfoSet
virtual bool IsTensorInfoSet() const =0
Returns true if this InputSlot either has an overridden TensorInfo for this InputSlot that was set th...
armnn::OptimizerOptionsOpaque::GetDebugToFileEnabled
bool GetDebugToFileEnabled() const
Definition: Network.cpp:186
armnn::SpaceToBatchNdDescriptor
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
Definition: Descriptors.hpp:1043
armnn::INetwork::AddRankLayer
IConnectableLayer * AddRankLayer(const char *name=nullptr)
Adds a rank layer to the network.
Definition: Network.cpp:433
armnn::INetwork::AddPadLayer
IConnectableLayer * AddPadLayer(const PadDescriptor &padDescriptor, const char *name=nullptr)
Adds a fully pad layer to the network.
Definition: Network.cpp:534
armnn::Convolution3dDescriptor
A Convolution3dDescriptor for the Convolution3dLayer.
Definition: Descriptors.hpp:588
armnn::BaseDescriptor
Base class for all descriptors.
Definition: Descriptors.hpp:22
armnn::experimental::WorkingMemHandle
Definition: WorkingMemHandle.hpp:29
armnn::INetwork::AddLstmLayer
IConnectableLayer * AddLstmLayer(const LstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)
Add a Lstm layer to the network.
Definition: Network.cpp:501
armnn::IConnectableLayer::BackendSelectionHint
virtual void BackendSelectionHint(Optional< BackendId > backend)=0
Provide a hint for the optimizer as to which backend to prefer for this layer.
armnn::NetworkImpl
Private implementation of INetwork.
Definition: Network.hpp:32
armnn::IOptimizedNetwork::AsyncNetworkImpl
friend class experimental::AsyncNetworkImpl
Definition: INetwork.hpp:935
armnn::IOptimizedNetwork::GetNumOutputs
size_t GetNumOutputs() const
Definition: Network.cpp:736
armnn::OptimizerOptions::m_ProfilingEnabled
bool m_ProfilingEnabled
Enable profiling dump of the optimizer phase.
Definition: INetwork.hpp:259
armnn::IOptimizedNetwork::Optimize
friend IOptimizedNetworkPtr Optimize(const INetwork &inNetwork, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptionsOpaque &options, Optional< std::vector< std::string > & > messages)
Create an optimized version of the network.
Definition: Network.cpp:2145
armnn::OptimizerOptionsOpaque::SetAllowExpandedDims
void SetAllowExpandedDims(bool ExpandedDimsAllowed)
Definition: Network.cpp:146
armnn::INetwork::AddStandInLayer
IConnectableLayer * AddStandInLayer(const StandInDescriptor &descriptor, const char *name=nullptr)
Add a stand-in layer for a type unknown to the Arm NN framework.
Definition: Network.cpp:604
LayerGuid
arm::pipe::ProfilingGuid LayerGuid
Define LayerGuid type.
Definition: Types.hpp:26
armnn::OptimizerOptionsOpaque::GetDebugEnabled
bool GetDebugEnabled() const
Definition: Network.cpp:181
armnn::IOptimizedNetwork::~IOptimizedNetwork
~IOptimizedNetwork()
armnn::INetwork::AddSwitchLayer
IConnectableLayer * AddSwitchLayer(const char *name=nullptr)
Adds a switch layer to the network.
Definition: Network.cpp:569
armnn::INetwork::AddElementwiseBinaryLayer
IConnectableLayer * AddElementwiseBinaryLayer(const ElementwiseBinaryDescriptor &elementwiseBinaryDescriptor, const char *name=nullptr)
Add an ElementwiseBinary layer to the network.
Definition: Network.cpp:314
armnn::ShapeInferenceMethod::ValidateOnly
@ ValidateOnly
Validate all output shapes.
armnn::INetwork::AddFillLayer
IConnectableLayer * AddFillLayer(const FillDescriptor &fillDescriptor, const char *name=nullptr)
Add an Fill layer to the network.
Definition: Network.cpp:326
armnn::BatchToSpaceNdDescriptor
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
Definition: Descriptors.hpp:875
armnn::Convolution2dDescriptor
A Convolution2dDescriptor for the Convolution2dLayer.
Definition: Descriptors.hpp:534
armnn::ComparisonDescriptor
A ComparisonDescriptor for the ComparisonLayer.
Definition: Descriptors.hpp:89
armnn::FillDescriptor
A FillDescriptor for the FillLayer.
Definition: Descriptors.hpp:925
armnn::INetwork::AddSubtractionLayer
IConnectableLayer * AddSubtractionLayer(const char *name=nullptr)
Adds a subtraction layer to the network.
Definition: Network.cpp:515
armnn::OptimizerOptions::m_ReduceFp32ToBf16
bool m_ReduceFp32ToBf16
@Note This feature has been replaced by enabling Fast Math in compute library backend options.
Definition: INetwork.hpp:247
armnn::INetwork::GetInputTensorInfo
friend TensorInfo GetInputTensorInfo(const INetwork *network)
armnn::StandInDescriptor
A StandInDescriptor for the StandIn layer.
Definition: Descriptors.hpp:1281
armnn::OptimizerOptions::m_ModelOptions
ModelOptions m_ModelOptions
Enable Model Options.
Definition: INetwork.hpp:256
armnn::INetwork::AddQuantizedLstmLayer
IConnectableLayer * AddQuantizedLstmLayer(const QuantizedLstmInputParams &params, const char *name=nullptr)
Add a QuantizedLstm layer to the network.
Definition: Network.cpp:610
IStrategy.hpp
armnn::IConnectableLayer::GetConstantTensorsByRef
virtual ConstantTensors GetConstantTensorsByRef()=0
armnn::IOutputSlot::GetOwningIConnectableLayer
virtual const IConnectableLayer & GetOwningIConnectableLayer() const =0
armnn::IConnectableLayer::ExecuteStrategy
virtual void ExecuteStrategy(IStrategy &strategy) const =0
Apply a visitor to this layer.
armnn::BackendOptions
Struct for the users to pass backend specific options.
Definition: BackendOptions.hpp:22
armnn::LstmDescriptor
An LstmDescriptor for the LstmLayer.
Definition: Descriptors.hpp:1102
armnn::StridedSliceDescriptor
A StridedSliceDescriptor for the StridedSliceLayer.
Definition: Descriptors.hpp:1303
armnn::INetwork::AddTransposeConvolution2dLayer
IConnectableLayer * AddTransposeConvolution2dLayer(const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)
Adds a 2D transpose convolution layer to the network.
Definition: Network.cpp:579
armnn::INetwork::INetwork
INetwork(NetworkOptions networkOptions={})
Definition: Network.cpp:45
TensorHandle.hpp
armnn::Status
Status
Definition: Types.hpp:42
armnn::IOutputSlot::Connect
virtual int Connect(IInputSlot &destination)=0
armnn::IOutputSlot::IsTensorInfoSet
virtual bool IsTensorInfoSet() const =0
armnn::LogicalBinaryDescriptor
A LogicalBinaryDescriptor for the LogicalBinaryLayer.
Definition: Descriptors.hpp:1518
armnn::IInputSlot::GetTensorInfo
virtual const TensorInfo & GetTensorInfo() const =0
Gets the TensorInfo for this InputSlot.
armnn::OptimizerOptionsOpaque::GetAllowExpandedDims
bool GetAllowExpandedDims() const
Definition: Network.cpp:191
armnn::INetwork::AddDepthwiseConvolution2dLayer
IConnectableLayer * AddDepthwiseConvolution2dLayer(const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
Adds a 2D depthwise convolution layer to the network.
Definition: Network.cpp:292
armnn::INetwork::AddPooling2dLayer
IConnectableLayer * AddPooling2dLayer(const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)
Adds a 2D pooling layer to the network.
Definition: Network.cpp:356
armnn::BoostLogSeverityMapping::debug
@ debug
armnn::INetwork::Optimize
friend IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options, Optional< std::vector< std::string > & > messages)
Accept legacy OptimizerOptions.
Definition: Network.cpp:2132
armnn::INetwork::AddNormalizationLayer
IConnectableLayer * AddNormalizationLayer(const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
Adds a normalization layer to the network.
Definition: Network.cpp:382
armnn::OptimizerOptionsOpaque::ToString
const std::string ToString() const
Definition: Network.cpp:206
ARMNN_DEPRECATED_MSG_REMOVAL_DATE
#define ARMNN_DEPRECATED_MSG_REMOVAL_DATE(message, removed_in_release)
Definition: Deprecated.hpp:44
armnn::INetwork::AddQuantizeLayer
IConnectableLayer * AddQuantizeLayer(const char *name=nullptr)
Add a quantize layer to the network.
Definition: Network.cpp:540
armnn::INetwork::Destroy
static void Destroy(INetwork *network)
Definition: Network.cpp:687
armnn::INetwork::pNetworkImpl
std::unique_ptr< NetworkImpl > pNetworkImpl
Definition: INetwork.hpp:895
armnn::OptimizerOptions
Definition: INetwork.hpp:151
armnn::IOptimizedNetwork::Destroy
static void Destroy(IOptimizedNetwork *network)
Definition: Network.cpp:706
armnn::IInputSlot::SetTensorInfo
virtual void SetTensorInfo(const TensorInfo tensorInfo)=0
Sets the TensorInfo for this InputSlot.
armnn::IOutputSlot::CalculateIndexOnOwner
virtual unsigned int CalculateIndexOnOwner() const =0
BackendOptions.hpp
armnn::BackendId
Definition: BackendId.hpp:75
armnn::OriginsDescriptor
An OriginsDescriptor for the ConcatLayer.
Definition: Descriptors.hpp:201
armnn::IOutputSlot::GetNumConnections
virtual unsigned int GetNumConnections() const =0
armnn::OptimizerOptionsOpaque::GetProfilingEnabled
bool GetProfilingEnabled() const
Definition: Network.cpp:156
armnn::IConnectableLayer::GetOutputSlot
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::ElementwiseUnaryDescriptor
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
Definition: Descriptors.hpp:129
armnn::TransposeConvolution2dDescriptor
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
Definition: Descriptors.hpp:1440
armnn::IConnectableLayer::GetInputSlot
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
armnn::OptimizerOptionsOpaque::SetProfilingEnabled
void SetProfilingEnabled(bool ProfilingState)
Definition: Network.cpp:121
armnn::IOutputSlot::~IOutputSlot
~IOutputSlot()
Not user deletable.
Definition: INetwork.hpp:76
armnn::IOptimizedNetwork::IOptimizedNetwork
IOptimizedNetwork(const IOptimizedNetwork &other, const ModelOptions &modelOptions)
Creates a copy of the IOptimizedNetwork.
Definition: Network.cpp:692
armnn::INetwork::AddConcatLayer
IConnectableLayer * AddConcatLayer(const ConcatDescriptor &concatDescriptor, const char *name=nullptr)
Adds a concatenation layer to the network.
Definition: Network.cpp:265
armnn::OptimizerOptionsOpaque::SetDebugToFileEnabled
void SetDebugToFileEnabled(bool DebugFileState)
Definition: Network.cpp:131
armnn::OptimizerOptions::m_DebugToFile
bool m_DebugToFile
Pass debug data to separate output files for easier troubleshooting.
Definition: INetwork.hpp:243
armnn::INetwork::AddMultiplicationLayer
IConnectableLayer * AddMultiplicationLayer(const char *name=nullptr)
Adds a multiplication layer to the network.
Definition: Network.cpp:416
armnn::INetwork::AddConvolution3dLayer
IConnectableLayer * AddConvolution3dLayer(const Convolution3dDescriptor &convolution3dDescriptor, const char *name=nullptr)
Adds a 3D convolution layer to the network.
Definition: Network.cpp:278
armnn::INetwork::AddScatterNdLayer
IConnectableLayer * AddScatterNdLayer(const ScatterNdDescriptor &descriptor, const char *name=nullptr)
Add a ScatterNd layer to the network.
Definition: Network.cpp:666
armnn::ConstTensor
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:329
armnn::IConnectableLayer
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:80
armnn::IInputSlot
An input connection slot for a layer.
Definition: INetwork.hpp:25
armnn::IDeviceSpec
Device specific knowledge to be passed to the optimizer.
Definition: Types.hpp:299
armnn::ModelOptions
std::vector< BackendOptions > ModelOptions
Definition: BackendOptions.hpp:18
armnn::INetwork::AddElementwiseUnaryLayer
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
Add an ElementwiseUnary layer to the network.
Definition: Network.cpp:320
armnn::DetectionPostProcessDescriptor
Definition: Descriptors.hpp:713
armnn::PreCompiledDescriptor
A PreCompiledDescriptor for the PreCompiledLayer.
Definition: Descriptors.hpp:1367
armnn::INetwork::AddChannelShuffleLayer
IConnectableLayer * AddChannelShuffleLayer(const ChannelShuffleDescriptor &descriptor, const char *name=nullptr)
Add a ChannelShuffle layer to the network.
Definition: Network.cpp:637
armnn::INetwork::AddInstanceNormalizationLayer
IConnectableLayer * AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
Adds an instance normalization layer to the network.
Definition: Network.cpp:450
armnn::INetwork::AddFloorLayer
IConnectableLayer * AddFloorLayer(const char *name=nullptr)
Adds a floor layer to the network.
Definition: Network.cpp:492
armnn::Pooling2dDescriptor
A Pooling2dDescriptor for the Pooling2dLayer.
Definition: Descriptors.hpp:371
armnn::IInputSlot::GetSlotIndex
virtual unsigned int GetSlotIndex() const =0
armnn::Optimize
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptionsOpaque &options=OptimizerOptionsOpaque(), Optional< std::vector< std::string > & > messages=EmptyOptional())
Create an optimized version of the network.
Definition: Network.cpp:2145
armnn::BroadcastToDescriptor
Definition: Descriptors.hpp:1659
armnn::DepthwiseConvolution2dDescriptor
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
Definition: Descriptors.hpp:659
armnn::ShapeInferenceMethod
ShapeInferenceMethod
The ShapeInferenceMethod modify how the output shapes are treated.
Definition: Types.hpp:235
armnn::OptimizerOptions::m_AllowExpandedDims
bool m_AllowExpandedDims
When calculating tensor sizes, dimensions of size == 1 will be ignored.
Definition: INetwork.hpp:265
armnn::INetwork::AddGatherLayer
IConnectableLayer * AddGatherLayer(const GatherDescriptor &descriptor, const char *name=nullptr)
Add Gather layer to the network.
Definition: Network.cpp:558
armnn::ScatterNdDescriptor
A ScatterNdDescriptor for the ScatterNdLayer.
Definition: Descriptors.hpp:1679
armnn::ReduceDescriptor
A ReduceDescriptor for the REDUCE operators.
Definition: Descriptors.hpp:1538
armnn::CompiledBlobDeleter
std::function< void(const void *)> CompiledBlobDeleter
Definition: INetwork.hpp:342
armnn::INetwork::AddBroadcastToLayer
IConnectableLayer * AddBroadcastToLayer(const BroadcastToDescriptor &descriptor, const char *name=nullptr)
Add a BroadcastTo layer to the network.
Definition: Network.cpp:660
armnn::INetwork::Create
static INetworkPtr Create(const NetworkOptions &networkOptions={})
Definition: Network.cpp:682
armnn::OptimizerOptionsOpaqueImpl
Definition: Network.hpp:310
armnn::LstmInputParams
Definition: LstmParams.hpp:13
armnn::LayerType
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition: Types.hpp:491
NetworkFwd.hpp
armnn::MeanDescriptor
A MeanDescriptor for the MeanLayer.
Definition: Descriptors.hpp:1172
armnn::QuantizedLstmInputParams
Definition: QuantizedLstmParams.hpp:13
armnn::CompiledBlobPtr
std::unique_ptr< void, CompiledBlobDeleter > CompiledBlobPtr
Definition: INetwork.hpp:343
armnn::Graph
Definition: Graph.hpp:30
armnn::OptimizerOptionsOpaque::SetDebugEnabled
void SetDebugEnabled(bool DebugState)
Definition: Network.cpp:126
armnn::TileDescriptor
Definition: Descriptors.hpp:1640
armnn::INetwork::AddBatchToSpaceNdLayer
IConnectableLayer * AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)
Adds a batch to space ND layer to the network.
Definition: Network.cpp:350
armnn::INetwork::PrintGraph
Status PrintGraph()
Definition: Network.cpp:237
armnn::SoftmaxDescriptor
A SoftmaxDescriptor for the SoftmaxLayer.
Definition: Descriptors.hpp:177
armnn::INetwork::AddResizeLayer
IConnectableLayer * AddResizeLayer(const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)
Adds a resize layer to the network.
Definition: Network.cpp:438
armnn::INetwork::AddInputLayer
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr)
Adds an input layer to the network.
Definition: Network.cpp:242
armnn::SpaceToDepthDescriptor
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
Definition: Descriptors.hpp:1075
armnn::INetwork::~INetwork
~INetwork()
armnn::INetwork::AddArgMinMaxLayer
IConnectableLayer * AddArgMinMaxLayer(const ArgMinMaxDescriptor &desc, const char *name=nullptr)
Adds an ArgMinMax layer to the network.
Definition: Network.cpp:247
armnn::IOptimizedNetwork::pOptimizedNetworkImpl
std::unique_ptr< OptimizedNetworkImpl > pOptimizedNetworkImpl
Definition: INetwork.hpp:953
armnn::INetwork::AddGatherNdLayer
IConnectableLayer * AddGatherNdLayer(const char *name=nullptr)
Add GatherNd layer to the network.
Definition: Network.cpp:564
armnn::INetwork::AddActivationLayer
IConnectableLayer * AddActivationLayer(const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
Adds an activation layer to the network.
Definition: Network.cpp:376
armnn::IConnectableLayer::~IConnectableLayer
~IConnectableLayer()
Objects are not deletable via the handle.
Definition: INetwork.hpp:148
armnn::INetwork
Main network class which provides the interface for building up a neural network.
Definition: INetwork.hpp:347
armnn::IOptimizedNetwork::GetModelOptionsForTesting
friend ModelOptions & GetModelOptionsForTesting(IOptimizedNetwork *optNetPtr)
Definition: TestUtils.cpp:54
armnn::OptimizerOptionsOpaque::SetImportEnabled
void SetImportEnabled(bool ImportState)
Definition: Network.cpp:111
armnn::IInputSlot::GetConnection
virtual const IOutputSlot * GetConnection() const =0
armnn::OptimizerOptionsOpaque
Definition: INetwork.hpp:272