ArmNN
 23.08
INetwork.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 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 permute layer to the network.
481  /// @param permuteDescriptor - PermuteDescriptor to configure the permute.
482  /// @param name - Optional name for the layer.
483  /// @return - Interface for configuring the layer.
484  IConnectableLayer* AddPermuteLayer(const PermuteDescriptor& permuteDescriptor,
485  const char* name = nullptr);
486 
487  /// Adds a batch to space ND layer to the network.
488  /// @param batchToSpaceNdDescriptor - Description of the layer.
489  /// @param name - Optional name for the layer.
490  /// @return - Interface for configuring the layer.
491  IConnectableLayer* AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor& batchToSpaceNdDescriptor,
492  const char* name = nullptr);
493 
494  /// Adds a 2D pooling layer to the network.
495  /// @param pooling2dDescriptor - Pooling2dDescriptor to configure the pooling.
496  /// @param name - Optional name for the layer.
497  /// @return - Interface for configuring the layer.
498  IConnectableLayer* AddPooling2dLayer(const Pooling2dDescriptor& pooling2dDescriptor,
499  const char* name = nullptr);
500 
501  /// Adds a 3D pooling layer to the network.
502  /// @param pooling3dDescriptor - Pooling3dDescriptor to configure the pooling.
503  /// @param name - Optional name for the layer.
504  /// @return - Interface for configuring the layer.
505  IConnectableLayer* AddPooling3dLayer(const Pooling3dDescriptor& pooling3dDescriptor,
506  const char* name = nullptr);
507 
508  /// Adds a Precompiled layer to the network.
509  /// Method use is for backend users.
510  /// @param preCompiledDescriptor - PreCompiledDescriptor contains parameters for the Precompiled layer.
511  /// @param compiledBlobPtr - CompiledBlobPtr pre-compiled object set for the Precompiled layer.
512  /// @param backend - optional BackendId set for the Precompiled layer.
513  /// @return - Interface for configuring the layer.
514  IConnectableLayer* AddPrecompiledLayer(const PreCompiledDescriptor& preCompiledDescriptor,
515  CompiledBlobPtr compiledBlobPtr,
516  const Optional<BackendId>& backend,
517  const char* name = nullptr);
518 
519  /// Adds an activation layer to the network.
520  /// @param activationDescriptor - ActivationDescriptor to configure the activation.
521  /// @param name - Optional name for the layer.
522  /// @return - Interface for configuring the layer.
523  IConnectableLayer* AddActivationLayer(const ActivationDescriptor& activationDescriptor,
524  const char* name = nullptr);
525 
526  /// Adds a normalization layer to the network.
527  /// @param normalizationDescriptor - NormalizationDescriptor to configure the normalization.
528  /// @param name - Optional name for the layer.
529  /// @return - Interface for configuring the layer.
530  IConnectableLayer* AddNormalizationLayer(const NormalizationDescriptor& normalizationDescriptor,
531  const char* name = nullptr);
532 
533  /// Adds a slice layer to the network.
534  /// @param sliceDescriptor - SliceDescriptor to configure the slice operation.
535  /// @param name - Optional name for the layer.
536  /// @return - Interface for configuring the layer.
537  IConnectableLayer* AddSliceLayer(const SliceDescriptor& sliceDescriptor, const char* name = nullptr);
538 
539  /// Adds a softmax layer to the network.
540  /// If the data type is QAsymm8, then the output quantization parameters
541  /// must have a scale of 1/256 and an offset of 0
542  /// @param softmaxDescriptor - SoftmaxDescriptor to configure the softmax.
543  /// @param name - Optional name for the layer.
544  /// @return - Interface for configuring the layer.
545  IConnectableLayer* AddSoftmaxLayer(const SoftmaxDescriptor& softmaxDescriptor,
546  const char* name = nullptr);
547 
548  /// Adds a splitter layer to the network.
549  /// @param splitterDescriptor - ViewsDescriptor to configure the splitting process.
550  /// Number of Views must be equal to the number of outputs,
551  /// and their order must match - e.g. first view corresponds to
552  /// the first output, second view to the second output, etc....
553  /// @param name - Optional name for the layer.
554  /// @return - Interface for configuring the layer.
555  IConnectableLayer* AddSplitterLayer(const ViewsDescriptor& splitterDescriptor,
556  const char* name = nullptr);
557 
558  /// Adds a merge layer to the network.
559  /// @param name - Optional name for the layer.
560  /// @return - Interface for configuring the layer.
561  IConnectableLayer* AddMergeLayer(const char* name = nullptr);
562 
563  /// Adds an addition layer to the network.
564  /// @param name - Optional name for the layer.
565  /// @return - Interface for configuring the layer.
566  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
567  IConnectableLayer* AddAdditionLayer(const char* name = nullptr);
568 
569  /// Adds a multiplication layer to the network.
570  /// @param name - Optional name for the layer.
571  /// @return - Interface for configuring the layer.
572  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
573  IConnectableLayer* AddMultiplicationLayer(const char* name = nullptr);
574 
575  /// Adds a batch normalization layer to the network.
576  /// @param mean - Pre-calculated mean for each channel.
577  /// @param variance - Pre-calculated variance for each channel.
578  /// @param beta - Per-channel additive factor.
579  /// @param gamma - Per-channel multiplicative factor.
580  /// @return - Interface for configuring the layer.
581  /// @param name - Optional name for the layer.
583  const ConstTensor& mean,
584  const ConstTensor& variance,
585  const ConstTensor& beta,
586  const ConstTensor& gamma,
587  const char* name = nullptr);
588 
589  /// Adds a rank layer to the network.
590  /// @param name - Optional name for the layer.
591  /// @return - Interface for configuring the layer.
592  IConnectableLayer* AddRankLayer(const char* name = nullptr);
593 
594  /// Adds a resize layer to the network.
595  /// @param resizeDescriptor - Parameters for the resize operation.
596  /// @param name - Optional name for the layer.
597  /// @return - Interface for configuring the layer.
598  IConnectableLayer* AddResizeLayer(const ResizeDescriptor& resizeDescriptor,
599  const char* name = nullptr);
600 
601  /// Adds a reduce layer to the network.
602  /// @param ReduceDescriptor - Parameters for the reduce operation.
603  /// @param name - Optional name for the layer.
604  /// @return - Interface for configuring the layer.
605  IConnectableLayer* AddReduceLayer(const ReduceDescriptor& reduceDescriptor,
606  const char* name = nullptr);
607 
608  /// Adds an instance normalization layer to the network.
609  /// @param desc - Parameters for the instance normalization operation.
610  /// @param name - Optional name for the layer.
611  /// @return - Interface for configuring the layer.
613  const char* name = nullptr);
614 
615  /// Adds an L2 normalization layer to the network.
616  /// Normalization is performed along dimension 1, but requires a 4d input.
617  /// @param desc - Parameters for the L2 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 a log softmax layer to the network.
624  /// @param logSoftmaxDescriptor - LogSoftmaxDescriptor to configure the log softmax.
625  /// @param name - Optional name for the layer.
626  /// @return - Interface for configuring the layer.
627  IConnectableLayer* AddLogSoftmaxLayer(const LogSoftmaxDescriptor& logSoftmaxDescriptor,
628  const char* name = nullptr);
629 
630  /// Adds a layer with no inputs and a single output, which always corresponds to
631  /// the passed in constant tensor.
632  /// @param input - Tensor to be provided as the only output of the layer. The layer will maintain
633  /// its own copy of the tensor data, meaning the memory referenced by @a input can
634  /// be freed or reused after this function is called.
635  /// @param name - Optional name for the layer.
636  /// @return - Interface for configuring the layer.
638  const char* name = nullptr);
639 
640  /// Adds a reshape layer to the network.
641  /// @param reshapeDescriptor - Parameters for the reshape operation.
642  /// @param name - Optional name for the layer.
643  /// @return - Interface for configuring the layer.
644  IConnectableLayer* AddReshapeLayer(const ReshapeDescriptor& reshapeDescriptor,
645  const char* name = nullptr);
646 
647  /// Adds a shape layer to the network.
648  /// @param name - Optional name for the layer.
649  /// @return - Interface for configuring the layer.
650  IConnectableLayer* AddShapeLayer(const char* name = nullptr);
651 
652  /// Adds a space to batch layer to the network.
653  /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation.
654  /// @param name - Optional name for the layer.
655  /// @return - Interface for configuring the layer.
656  IConnectableLayer* AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor,
657  const char* name = nullptr);
658 
659  /// Adds a space to depth layer to the network.
660  /// @param spaceToDepthDescriptor - Parameters for the space to depth operation.
661  /// @param name - Optional name for the layer.
662  /// @return - Interface for configuring the layer.
663  IConnectableLayer* AddSpaceToDepthLayer(const SpaceToDepthDescriptor& spaceToDepthDescriptor,
664  const char* name = nullptr);
665 
666  /// Adds a floor layer to the network.
667  /// @param name - Optional name for the layer.
668  /// @return - Interface for configuring the layer.
669  IConnectableLayer* AddFloorLayer(const char* name = nullptr);
670 
671  /// Adds an output layer to the network.
672  /// @param id - User generated id to uniquely identify a particular output. The same id needs to be specified
673  /// when passing the outputs to the IRuntime::EnqueueWorkload() function.
674  /// @param name - Optional name for the layer.
675  /// @return - Interface for configuring the layer.
676  IConnectableLayer* AddOutputLayer(LayerBindingId id, const char* name = nullptr);
677 
678  /// Add a Lstm layer to the network
679  /// @param descriptor - Parameters for the Lstm operation
680  /// @param params - Weights and biases for the LSTM cell
681  /// @param name - Optional name for the layer
682  /// @return - Interface for configuring the layer.
683  IConnectableLayer* AddLstmLayer(const LstmDescriptor& descriptor,
684  const LstmInputParams& params,
685  const char* name = nullptr);
686 
687  /// Adds a division layer to the network.
688  /// @param name - Optional name for the layer.
689  /// @return - Interface for configuring the layer.
690  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
691  IConnectableLayer* AddDivisionLayer(const char* name = nullptr);
692 
693  /// Adds a subtraction layer to the network.
694  /// @param name - Optional name for the layer.
695  /// @return - Interface for configuring the layer.
696  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
697  IConnectableLayer* AddSubtractionLayer(const char* name = nullptr);
698 
699  /// Add a Maximum layer to the network.
700  /// @param name - Optional name for the layer.
701  /// @return - Interface for configuring the layer.
702  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
703  IConnectableLayer* AddMaximumLayer(const char* name = nullptr);
704 
705  /// Add a Mean layer to the network.
706  /// @param meanDescriptor - Parameters for the mean operation.
707  /// @param name - Optional name for the layer.
708  /// @return - Interface for configuring the layer.
709  IConnectableLayer* AddMeanLayer(const MeanDescriptor& meanDescriptor, const char* name = nullptr);
710 
711  /// Adds a fully pad layer to the network.
712  /// @param paddings - n by 2 tensor, where n is the rank of the input tensor,
713  /// such that paddings[i,0] indicates the amount of padding to add in front of dimonsion i, and
714  /// paddings[i,1] indicates the amount of padding to add after the end of dimension i
715  /// @param name - Optional name for the layer.
716  /// @return - Interface for configuring the layer.
717  IConnectableLayer* AddPadLayer(const PadDescriptor& padDescriptor,
718  const char* name = nullptr);
719 
720  /// Add a quantize layer to the network
721  ///@param name - Optional name for the layer.
722  /// @return - Interface for configuring the layer.
723  IConnectableLayer* AddQuantizeLayer(const char* name = nullptr);
724 
725  /// Adds a strided slice layer to the network.
726  /// @param StridedSliceDescriptor - Parameters for the strided slice operation.
727  /// @param name - Optional name for the layer.
728  /// @return - Interface for configuring the layer.
729  IConnectableLayer* AddStridedSliceLayer(const StridedSliceDescriptor& stridedSliceDescriptor,
730  const char* name = nullptr);
731 
732  /// Add a Minimum layer to the network.
733  /// @param name - Optional name for the layer.
734  /// @return - Interface for configuring the layer.
735  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use AddElementwiseBinaryLayer instead", "24.02")
736  IConnectableLayer* AddMinimumLayer(const char* name = nullptr);
737 
738  /// Add Gather layer to the network.
739  /// @param descriptor - Description of the gather layer.
740  /// @param name - Optional name for the layer.
741  /// @return - Interface for configuring the layer.
743  const char* name = nullptr);
744 
745  /// Add GatherNd layer to the network.
746  /// @param name - Optional name for the layer.
747  /// @return - Interface for configuring the layer.
748  IConnectableLayer* AddGatherNdLayer(const char* name = nullptr);
749 
750  /// Adds a switch layer to the network.
751  /// @param name - Optional name for the layer.
752  /// @return - Interface for configuring the layer.
753  IConnectableLayer* AddSwitchLayer(const char* name = nullptr);
754 
755  /// Adds a PReLU layer to the network.
756  /// @param name - Optional name for the layer.
757  /// @return - Interface for configuring the layer.
758  IConnectableLayer* AddPreluLayer(const char* name = nullptr);
759 
760  /// Adds a 2D transpose convolution layer to the network.
761  /// @param descriptor - Description of the 2D transpose convolution layer.
762  /// @param weights - Tensor for the weights data.
763  /// @param biases - Optional tensor for the bias data.
764  /// @param name - Optional name for the layer.
765  /// @return - Interface for configuring the layer.
767  const ConstTensor& weights,
768  const Optional<ConstTensor>& biases,
769  const char* name = nullptr);
770 
771  /// Adds a transpose layer to the network.
772  /// @param transposeDescriptor - TransposeDescriptor to configure the transpose.
773  /// @param name - Optional name for the layer.
774  /// @return - Interface for configuring the layer.
775  IConnectableLayer* AddTransposeLayer(const TransposeDescriptor& transposeDescriptor,
776  const char* name = nullptr);
777 
778  /// Adds a stack layer to the network.
779  /// @param descriptor - Description of the stack layer.
780  /// @param name - Optional name for the layer.
781  /// @return - Interface for configuring the layer.
783  const char* name = nullptr);
784 
785  /// Add a stand-in layer for a type unknown to the Arm NN framework.
786  /// Note: Due to the nature of this layer, no validation can be performed by the framework.
787  /// Furthermore, Any model containing this layer cannot make use of dynamic tensors since the
788  /// tensor sizes cannot be inferred.
789  /// @descriptor - Descriptor for the StandIn layer.
790  /// @return - Interface for configuring the layer.
792  const char* name = nullptr);
793 
794  /// Add a QuantizedLstm layer to the network
795  /// @param params - The weights and biases for the Quantized LSTM cell
796  /// @param name - Optional name for the layer
797  /// @return - Interface for configuring the layer.
799  const char* name = nullptr);
800 
801  /// Add a QLstm layer to the network
802  /// @param descriptor - Parameters for the QLstm operation
803  /// @param params - Weights and biases for the layer
804  /// @param name - Optional name for the layer
805  /// @return - Interface for configuring the layer.
807  const LstmInputParams& params,
808  const char* name = nullptr);
809 
810  /// Adds a Logical Binary layer to the network.
811  /// @param descriptor - Description of the Logical Binary layer.
812  /// @param name - Optional name for the layer.
813  /// @return - Interface for configuring the layer.
815  const char* name = nullptr);
816 
817  /// Add a UnidirectionalSequenceLstm layer to the network
818  /// @param descriptor - Parameters for the UnidirectionalSequenceLstm operation
819  /// @param params - Weights and biases for the UnidirectionalSequenceLstm
820  /// @param name - Optional name for the layer
821  /// @return - Interface for configuring the layer.
823  const LstmInputParams& params,
824  const char* name = nullptr);
825 
826  /// Add a ChannelShuffle layer to the network
827  /// @param descriptor - Parameters for the ChannelShuffle operation
828  /// @param name - Optional name for the layer
829  /// @return - Interface for configuring the layer
831  const char* name = nullptr);
832 
833  /// Add a BatchMatMul layer to the network
834  /// @param descriptor - Parameters for the BatchMatMul operation
835  /// @param name - Optional name for the layer
836  /// @return - Interface for configuring the layer
838  const char* name = nullptr);
839 
840  /// Add a ReverseV2 layer to the network
841  /// @param name - Optional name for the layer
842  /// @return - Interface for configuring the layer
843  IConnectableLayer* AddReverseV2Layer(const char* name = nullptr);
844 
845  /// Add a Tile layer to the network
846  /// @param descriptor - Parameters for the Tile operation
847  /// @param name - Optional name for the layer
848  /// @return - Interface for configuring the layer
849  IConnectableLayer* AddTileLayer(const TileDescriptor& descriptor,
850  const char* name = nullptr);
851 
852  void ExecuteStrategy(IStrategy& strategy) const;
853 
854 protected:
855  ~INetwork();
856 
857  friend void VisitLayersTopologically(const INetwork* inputNetwork, IStrategy& strategy);
859  friend TensorInfo GetInputTensorInfo(const INetwork* network);
860  friend IOptimizedNetworkPtr Optimize(const INetwork& network,
861  const std::vector<BackendId>& backendPreferences,
862  const IDeviceSpec& deviceSpec,
863  const OptimizerOptions& options,
864  Optional<std::vector<std::string>&> messages);
865  friend IOptimizedNetworkPtr Optimize(const INetwork& network,
866  const std::vector<BackendId>& backendPreferences,
867  const IDeviceSpec& deviceSpec,
868  const OptimizerOptionsOpaque& options,
869  Optional<std::vector<std::string>&> messages);
870 
871  INetwork(NetworkOptions networkOptions = {});
872 
873  std::unique_ptr<NetworkImpl> pNetworkImpl;
874 };
875 
876 namespace experimental
877 {
878 class AsyncNetworkImpl;
879 class WorkingMemHandle;
880 }
881 
882 struct BackendSettings;
883 struct OptimizationResult;
884 class OptimizedNetworkImpl;
885 class IProfiler;
887 {
888 public:
889  static void Destroy(IOptimizedNetwork* network);
890 
891  Status PrintGraph();
892  Status SerializeToDot(std::ostream& stream) const;
893 
894  arm::pipe::ProfilingGuid GetGuid() const;
895 
896  size_t GetNumInputs() const;
897  size_t GetNumOutputs() const;
898 
899  void ExecuteStrategy(IStrategy& strategy) const;
900 
901  /// Creates a copy of the IOptimizedNetwork. The IOptimizedNetwork will not be reoptimized,
902  /// the provided ModelOptions will only be used when creating a LoadedNetwork.
903  IOptimizedNetwork(const IOptimizedNetwork& other, const ModelOptions& modelOptions);
904  IOptimizedNetwork(std::unique_ptr<Graph> graph);
905  IOptimizedNetwork(std::unique_ptr<OptimizedNetworkImpl> impl);
907 
908  const std::shared_ptr<IProfiler>& GetProfiler() const;
909 
910 protected:
911  friend class LoadedNetwork;
912 
915 
916  friend Graph& GetGraphForTesting(IOptimizedNetwork* optNetPtr);
918  friend IOptimizedNetworkPtr Optimize(const INetwork& inNetwork,
919  const std::vector<BackendId>& backendPreferences,
920  const IDeviceSpec& deviceSpec,
921  const OptimizerOptionsOpaque& options,
922  Optional<std::vector<std::string>&> messages);
923  friend IOptimizedNetworkPtr Optimize(const Graph& inGraph,
924  const std::vector<BackendId>& backendPreferences,
925  const IDeviceSpec& deviceSpec,
926  const OptimizerOptionsOpaque& options,
927  Optional<std::vector<std::string>&> messages);
928 
929  IOptimizedNetwork(std::unique_ptr<Graph> graph, const ModelOptions& modelOptions);
930 
931  std::unique_ptr<OptimizedNetworkImpl> pOptimizedNetworkImpl;
932 };
933 
934 /// Create an optimized version of the network
935 /// @param network INetwork description of the network to be optimized.
936 /// @param backendPreferences The choice of the backend ordered by user preferences.
937 /// @param deviceSpec DeviceSpec object as queried from the runtime. See IRuntime::GetDeviceSpec()
938 /// @param messages If there are failures or warnings a string describing same will be added to the vector
939 /// @param options OptimizerOptions object with optimizer configuration options
940 /// @return An IOptimizedNetworkPtr interface to the optimized network, throws an exception derived from
941 /// armnn::Exception if process fails.
942 
943 IOptimizedNetworkPtr Optimize(const INetwork& network,
944  const std::vector<BackendId>& backendPreferences,
945  const IDeviceSpec& deviceSpec,
947  Optional<std::vector<std::string>&> messages = EmptyOptional());
948 
949 /// Create an optimized version of the network
950 /// @param inGraph Graph to be optimized.
951 /// @param backendPreferences The choice of the backend ordered by user preferences.
952 /// @param deviceSpec DeviceSpec object as queried from the runtime. See IRuntime::GetDeviceSpec()
953 /// @param messages If there are failures or warnings a string describing same will be added to the vector
954 /// @param options OptimizerOptions object with optimizer configuration options
955 /// @return An IOptimizedNetworkPtr interface to the optimized network, throws an exception derived from
956 /// armnn::Exception if process fails.
957 
958 IOptimizedNetworkPtr Optimize(const Graph& inGraph,
959  const std::vector<BackendId>& backendPreferences,
960  const IDeviceSpec& deviceSpec,
961  const OptimizerOptionsOpaque& options,
962  Optional<std::vector<std::string>&> messages = EmptyOptional());
963 
964 /// Accept legacy OptimizerOptions
965 IOptimizedNetworkPtr Optimize(const Graph& inGraph,
966  const std::vector<BackendId>& backendPreferences,
967  const IDeviceSpec& deviceSpec,
968  const OptimizerOptions& options,
969  Optional<std::vector<std::string>&> messages = EmptyOptional());
970 
971 /// Accept legacy OptimizerOptions
972 IOptimizedNetworkPtr Optimize(const INetwork& network,
973  const std::vector<BackendId>& backendPreferences,
974  const IDeviceSpec& deviceSpec,
975  const OptimizerOptions& options,
976  Optional<std::vector<std::string>&> messages = EmptyOptional());
977 
978 } //namespace armnn
armnn::INetwork::AddReshapeLayer
IConnectableLayer * AddReshapeLayer(const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
Adds a reshape layer to the network.
Definition: Network.cpp:468
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:643
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:3065
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:462
armnn::INetwork::ExecuteStrategy
void ExecuteStrategy(IStrategy &strategy) const
Definition: Network.cpp:654
armnn::ViewsDescriptor
A ViewsDescriptor for the SplitterLayer.
Definition: Descriptors.hpp:244
armnn::IOptimizedNetwork::GetProfiler
const std::shared_ptr< IProfiler > & GetProfiler() const
Definition: Network.cpp:703
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:610
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:438
armnn::INetwork::AddMaximumLayer
IConnectableLayer * AddMaximumLayer(const char *name=nullptr)
Add a Maximum layer to the network.
Definition: Network.cpp:516
armnn::OptimizerOptions::m_ImportEnabled
bool m_ImportEnabled
Enable Import.
Definition: INetwork.hpp:253
armnn::QLstmDescriptor
A QLstmDescriptor for the QLstmLayer.
Definition: Descriptors.hpp:1359
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:403
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:382
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:964
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:944
armnn::INetwork::AddMeanLayer
IConnectableLayer * AddMeanLayer(const MeanDescriptor &meanDescriptor, const char *name=nullptr)
Add a Mean layer to the network.
Definition: Network.cpp:523
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:713
armnn::INetwork::AddTileLayer
IConnectableLayer * AddTileLayer(const TileDescriptor &descriptor, const char *name=nullptr)
Add a Tile layer to the network.
Definition: Network.cpp:648
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:474
armnn::INetwork::AddL2NormalizationLayer
IConnectableLayer * AddL2NormalizationLayer(const L2NormalizationDescriptor &desc, const char *name=nullptr)
Adds an L2 normalization layer to the network.
Definition: Network.cpp:450
armnn::IOutputSlot::Disconnect
virtual void Disconnect(IInputSlot &slot)=0
armnn::IOptimizedNetwork::SerializeToDot
Status SerializeToDot(std::ostream &stream) const
Definition: Network.cpp:698
armnn::NormalizationDescriptor
A NormalizationDescriptor for the NormalizationLayer.
Definition: Descriptors.hpp:769
armnn::IOptimizedNetwork::GetGuid
arm::pipe::ProfilingGuid GetGuid() const
Definition: Network.cpp:708
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:693
armnn::ChannelShuffleDescriptor
A ChannelShuffleDescriptor for the ChannelShuffle operator.
Definition: Descriptors.hpp:1541
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:886
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:637
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:456
armnn::INetwork::TestConnectionPreservation
friend class TestConnectionPreservation
Definition: INetwork.hpp:858
armnn::OptimizerOptionsOpaque::GetImportEnabled
bool GetImportEnabled() const
Definition: Network.cpp:161
armnn::StackDescriptor
A StackDescriptor for the StackLayer.
Definition: Descriptors.hpp:1230
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:659
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:568
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:490
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:539
armnn::INetwork::AddSoftmaxLayer
IConnectableLayer * AddSoftmaxLayer(const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
Adds a softmax layer to the network.
Definition: Network.cpp:386
armnn::INetwork::AddPermuteLayer
IConnectableLayer * AddPermuteLayer(const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
Adds a permute layer to the network.
Definition: Network.cpp:338
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:581
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:592
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:356
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::INetwork::AddUnidirectionalSequenceLstmLayer
IConnectableLayer * AddUnidirectionalSequenceLstmLayer(const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)
Add a UnidirectionalSequenceLstm layer to the network.
Definition: Network.cpp:623
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:398
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:480
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:362
Logging.hpp
armnn::PadDescriptor
A PadDescriptor for the PadLayer.
Definition: Descriptors.hpp:1175
armnn::IOutputSlot::SetTensorInfo
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
armnn::TransposeDescriptor
A TransposeDescriptor for the TransposeLayer.
Definition: Descriptors.hpp:1469
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:1207
armnn::INetwork::AddSplitterLayer
IConnectableLayer * AddSplitterLayer(const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
Adds a splitter layer to the network.
Definition: Network.cpp:392
armnn::INetwork::AddShapeLayer
IConnectableLayer * AddShapeLayer(const char *name=nullptr)
Adds a shape layer to the network.
Definition: Network.cpp:587
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:417
armnn::ReshapeDescriptor
A ReshapeDescriptor for the ReshapeLayer.
Definition: Descriptors.hpp:1002
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:303
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:545
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:1563
armnn::INetwork::AddLogicalBinaryLayer
IConnectableLayer * AddLogicalBinaryLayer(const LogicalBinaryDescriptor &descriptor, const char *name=nullptr)
Adds a Logical Binary layer to the network.
Definition: Network.cpp:617
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:502
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:1022
armnn::INetwork::AddRankLayer
IConnectableLayer * AddRankLayer(const char *name=nullptr)
Adds a rank layer to the network.
Definition: Network.cpp:427
armnn::INetwork::AddPadLayer
IConnectableLayer * AddPadLayer(const PadDescriptor &padDescriptor, const char *name=nullptr)
Adds a fully pad layer to the network.
Definition: Network.cpp:528
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:495
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:913
armnn::IOptimizedNetwork::GetNumOutputs
size_t GetNumOutputs() const
Definition: Network.cpp:718
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:2091
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:598
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:563
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:509
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:1260
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:604
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:1081
armnn::StridedSliceDescriptor
A StridedSliceDescriptor for the StridedSliceLayer.
Definition: Descriptors.hpp:1282
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:573
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:1497
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:350
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:2078
armnn::INetwork::AddNormalizationLayer
IConnectableLayer * AddNormalizationLayer(const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
Adds a normalization layer to the network.
Definition: Network.cpp:376
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:534
armnn::INetwork::Destroy
static void Destroy(INetwork *network)
Definition: Network.cpp:669
armnn::INetwork::pNetworkImpl
std::unique_ptr< NetworkImpl > pNetworkImpl
Definition: INetwork.hpp:873
armnn::OptimizerOptions
Definition: INetwork.hpp:151
armnn::IOptimizedNetwork::Destroy
static void Destroy(IOptimizedNetwork *network)
Definition: Network.cpp:688
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:1419
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:674
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:410
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::ConstTensor
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:327
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:293
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:1346
armnn::INetwork::AddChannelShuffleLayer
IConnectableLayer * AddChannelShuffleLayer(const ChannelShuffleDescriptor &descriptor, const char *name=nullptr)
Add a ChannelShuffle layer to the network.
Definition: Network.cpp:631
armnn::INetwork::AddInstanceNormalizationLayer
IConnectableLayer * AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
Adds an instance normalization layer to the network.
Definition: Network.cpp:444
armnn::INetwork::AddFloorLayer
IConnectableLayer * AddFloorLayer(const char *name=nullptr)
Adds a floor layer to the network.
Definition: Network.cpp:486
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:2091
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:234
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:552
armnn::ReduceDescriptor
A ReduceDescriptor for the REDUCE operators.
Definition: Descriptors.hpp:1517
armnn::CompiledBlobDeleter
std::function< void(const void *)> CompiledBlobDeleter
Definition: INetwork.hpp:342
armnn::INetwork::Create
static INetworkPtr Create(const NetworkOptions &networkOptions={})
Definition: Network.cpp:664
armnn::OptimizerOptionsOpaqueImpl
Definition: Network.hpp:301
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:483
NetworkFwd.hpp
armnn::MeanDescriptor
A MeanDescriptor for the MeanLayer.
Definition: Descriptors.hpp:1151
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:1619
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:344
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:432
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:1054
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:931
armnn::INetwork::AddGatherNdLayer
IConnectableLayer * AddGatherNdLayer(const char *name=nullptr)
Add GatherNd layer to the network.
Definition: Network.cpp:558
armnn::INetwork::AddActivationLayer
IConnectableLayer * AddActivationLayer(const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
Adds an activation layer to the network.
Definition: Network.cpp:370
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