ArmNN
 22.02
ClBackend.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ClBackend.hpp"
7 #include "ClBackendContext.hpp"
9 #include "ClBackendId.hpp"
12 #include "ClLayerSupport.hpp"
14 #include "ClWorkloadFactory.hpp"
15 
17 #include <armnn/Descriptors.hpp>
18 
22 
26 
36 
37 #include <Optimizer.hpp>
38 
39 #include <arm_compute/core/Types.h>
40 #include <arm_compute/runtime/CL/CLBufferAllocator.h>
41 
42 namespace armnn
43 {
44 
46 {
47  static const BackendId s_Id{ClBackendId()};
48  return s_Id;
49 }
50 
52 {
54  {
55  return std::make_unique<ClMemoryManager>(m_CustomAllocator);
56  }
57  return std::make_unique<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
58 }
59 
61  const IBackendInternal::IMemoryManagerSharedPtr& memoryManager) const
62 {
63  return std::make_unique<ClWorkloadFactory>(
64  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager));
65 }
66 
68  const IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const ModelOptions& modelOptions) const
69 {
70  return std::make_unique<ClWorkloadFactory>(
71  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager), CreateBackendSpecificModelContext(modelOptions));
72 }
73 
75  TensorHandleFactoryRegistry& registry) const
76 {
77  std::shared_ptr<ClMemoryManager> memoryManager;
79  {
80  memoryManager = std::make_shared<ClMemoryManager>(m_CustomAllocator);
81  }
82  else
83  {
84  memoryManager = std::make_shared<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
85  }
86 
87  std::unique_ptr<ITensorHandleFactory> factory = std::make_unique<ClTensorHandleFactory>(memoryManager);
88  std::unique_ptr<ITensorHandleFactory> importFactory = std::make_unique<ClImportTensorHandleFactory>(
89  static_cast<MemorySourceFlags>(MemorySource::Malloc), static_cast<MemorySourceFlags>(MemorySource::Malloc));
90 
91  registry.RegisterCopyAndImportFactoryPair(factory->GetId(), importFactory->GetId());
92  registry.RegisterCopyAndImportFactoryPair(importFactory->GetId(), factory->GetId());
93 
94  registry.RegisterMemoryManager(memoryManager);
95  registry.RegisterFactory(std::move(factory));
96  registry.RegisterFactory(std::move(importFactory));
97 
98  return std::make_unique<ClWorkloadFactory>(
99  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager));
100 }
101 
103  TensorHandleFactoryRegistry& registry, const ModelOptions& modelOptions) const
104 {
105  std::shared_ptr<ClMemoryManager> memoryManager;
107  {
108  memoryManager = std::make_shared<ClMemoryManager>(m_CustomAllocator);
109  }
110  else
111  {
112  memoryManager = std::make_shared<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
113  }
114 
115  std::unique_ptr<ITensorHandleFactory> factory = std::make_unique<ClTensorHandleFactory>(memoryManager);
116  std::unique_ptr<ITensorHandleFactory> importFactory = std::make_unique<ClImportTensorHandleFactory>(
117  static_cast<MemorySourceFlags>(MemorySource::Malloc), static_cast<MemorySourceFlags>(MemorySource::Malloc));
118 
119  registry.RegisterCopyAndImportFactoryPair(factory->GetId(), importFactory->GetId());
120  registry.RegisterCopyAndImportFactoryPair(importFactory->GetId(), factory->GetId());
121 
122  registry.RegisterMemoryManager(memoryManager);
123  registry.RegisterFactory(std::move(factory));
124  registry.RegisterFactory(std::move(importFactory));
125 
126  return std::make_unique<ClWorkloadFactory>(
127  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager), CreateBackendSpecificModelContext(modelOptions));
128 }
129 
131  TensorHandleFactoryRegistry& registry,
132  const ModelOptions& modelOptions,
133  MemorySourceFlags inputFlags,
134  MemorySourceFlags outputFlags) const
135 {
136  // To allow force import if inputFlags/outputFlags are Undefined, set it as Malloc
137  if (inputFlags == static_cast<MemorySourceFlags>(MemorySource::Undefined))
138  {
139  inputFlags = static_cast<MemorySourceFlags>(MemorySource::Malloc);
140  }
141  if (outputFlags == static_cast<MemorySourceFlags>(MemorySource::Undefined))
142  {
143  outputFlags = static_cast<MemorySourceFlags>(MemorySource::Malloc);
144  }
145  std::shared_ptr<ClMemoryManager> memoryManager;
147  {
148  memoryManager = std::make_shared<ClMemoryManager>(m_CustomAllocator);
149  }
150  else
151  {
152  memoryManager = std::make_shared<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
153  }
154 
155  std::unique_ptr<ITensorHandleFactory> factory = std::make_unique<ClTensorHandleFactory>(memoryManager);
156  std::unique_ptr<ITensorHandleFactory> importFactory = std::make_unique<ClImportTensorHandleFactory>(
157  inputFlags, outputFlags);
158 
159  registry.RegisterCopyAndImportFactoryPair(factory->GetId(), importFactory->GetId());
160  registry.RegisterCopyAndImportFactoryPair(importFactory->GetId(), factory->GetId());
161 
162  registry.RegisterMemoryManager(memoryManager);
163  registry.RegisterFactory(std::move(factory));
164  registry.RegisterFactory(std::move(importFactory));
165 
166  return std::make_unique<ClWorkloadFactory>(
167  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager), CreateBackendSpecificModelContext(modelOptions));
168 }
169 
170 std::vector<ITensorHandleFactory::FactoryId> ClBackend::GetHandleFactoryPreferences() const
171 {
172  return std::vector<ITensorHandleFactory::FactoryId> {ClTensorHandleFactory::GetIdStatic(),
174 }
175 
177 {
178  std::shared_ptr<ClMemoryManager> memoryManager;
180  {
181  memoryManager = std::make_shared<ClMemoryManager>(m_CustomAllocator);
182  }
183  else
184  {
185  memoryManager = std::make_shared<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
186  }
187 
188  std::unique_ptr<ITensorHandleFactory> factory = std::make_unique<ClTensorHandleFactory>(memoryManager);
189  std::unique_ptr<ITensorHandleFactory> importFactory = std::make_unique<ClImportTensorHandleFactory>(
190  static_cast<MemorySourceFlags>(MemorySource::Malloc), static_cast<MemorySourceFlags>(MemorySource::Malloc));
191 
192  registry.RegisterCopyAndImportFactoryPair(factory->GetId(), importFactory->GetId());
193  registry.RegisterCopyAndImportFactoryPair(importFactory->GetId(), factory->GetId());
194 
195  registry.RegisterMemoryManager(memoryManager);
196  registry.RegisterFactory(std::move(factory));
197  registry.RegisterFactory(std::move(importFactory));
198 
199 }
200 
202  MemorySourceFlags inputFlags,
203  MemorySourceFlags outputFlags)
204 {
205  // To allow force import if inputFlags/outputFlags are Undefined, set it as Malloc
206  if (inputFlags == static_cast<MemorySourceFlags>(MemorySource::Undefined))
207  {
208  inputFlags = static_cast<MemorySourceFlags>(MemorySource::Malloc);
209  }
210  if (outputFlags == static_cast<MemorySourceFlags>(MemorySource::Undefined))
211  {
212  outputFlags = static_cast<MemorySourceFlags>(MemorySource::Malloc);
213  }
214  std::shared_ptr<ClMemoryManager> memoryManager;
216  {
217  memoryManager = std::make_shared<ClMemoryManager>(m_CustomAllocator);
218  }
219  else
220  {
221  memoryManager = std::make_shared<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
222  }
223 
224  std::unique_ptr<ITensorHandleFactory> factory = std::make_unique<ClTensorHandleFactory>(memoryManager);
225  std::unique_ptr<ITensorHandleFactory> importFactory = std::make_unique<ClImportTensorHandleFactory>(
226  inputFlags, outputFlags);
227 
228  registry.RegisterCopyAndImportFactoryPair(factory->GetId(), importFactory->GetId());
229  registry.RegisterCopyAndImportFactoryPair(importFactory->GetId(), factory->GetId());
230 
231  registry.RegisterMemoryManager(memoryManager);
232  registry.RegisterFactory(std::move(factory));
233  registry.RegisterFactory(std::move(importFactory));
234 }
235 
237 {
238  return IBackendContextPtr{new ClBackendContext{options}};
239 }
240 
243 {
245 }
246 
248  const ModelOptions& modelOptions) const
249 {
250  return IBackendSpecificModelContextPtr{new ClBackendModelContext{modelOptions}};
251 }
252 
254 {
255  static ILayerSupportSharedPtr layerSupport
256  {
258  };
259  return layerSupport;
260 }
261 
263 {
264  static ILayerSupportSharedPtr layerSupport
265  {
267  };
268  return layerSupport;
269 }
270 
271 std::unique_ptr<ICustomAllocator> ClBackend::GetDefaultAllocator() const
272 {
273  return std::make_unique<ClBackendDefaultAllocator>();
274 }
275 
277  const ModelOptions& modelOptions) const
278 {
279  OptimizationViews optimizationViews;
280 
281  auto it = subgraph.endIConnectable();
282  bool isFastMathEnabled = false;
283  std::map<LayerGuid, Layer*> untouched;
284 
285  while (it != subgraph.beginIConnectable())
286  {
287  --it;
288  Layer& base = *(PolymorphicDowncast<Layer*>(*it));
289  untouched.insert({base.GetGuid(), &base});
290  }
291 
292  it = subgraph.endIConnectable();
293 #if defined(ARMCOMPUTECL_ENABLED)
295 
296  if (modelContextPtr)
297  {
298  auto clModelOptions = dynamic_cast<ClBackendModelContext*>(modelContextPtr.get());
299  if (clModelOptions)
300  {
301  isFastMathEnabled = clModelOptions->IsFastMathEnabled();
302  }
303  }
304 #endif
305  while (it != subgraph.beginIConnectable())
306  {
307  --it;
308  Layer& base = *(PolymorphicDowncast<Layer*>(*it));
309 
310  // Fuse activation into previous layer if supported by backend
314  || base.GetType() == LayerType::Subtraction || base.GetType() == LayerType::Division)
315  && (base.GetAdditionalInformation<ActivationDescriptor>() == nullptr))
316  {
317  for (auto output = base.BeginOutputSlots(); output != base.EndOutputSlots(); ++output)
318  {
319  if (output->GetNumConnections() == 1)
320  {
321  for (auto&& childInput : output->GetConnections())
322  {
323  if ((childInput->GetOwningLayer().GetType() == LayerType::Activation) &&
324  (checkDataTypeInputandOutput(childInput->GetOwningLayer())))
325  {
326  Layer& child = childInput->GetOwningLayer();
327 
328  auto* activationLayer = PolymorphicDowncast<ActivationLayer*>(&child);
329 
330  const std::string name = std::string("fused-") + child.GetName() + std::string("-into-") +
331  base.GetName();
332 
333  // Get params from activation layer
334  ActivationDescriptor activationDesc = activationLayer->GetParameters();
335 
336  if (base.GetType() == LayerType::Convolution2d)
337  {
338  Convolution2dLayer* baseLayer = PolymorphicDowncast<Convolution2dLayer*>(&base);
339 
340  Optional<TensorInfo> biases;
341 
342  if (baseLayer->GetParameters().m_BiasEnabled)
343  {
344  biases = baseLayer->m_Bias->GetTensorInfo();
345  }
346 
349  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
350  baseLayer->GetParameters(),
351  baseLayer->m_Weight->GetTensorInfo(),
352  biases,
353  isFastMathEnabled,
354  &activationDesc);
355 
356  if (status)
357  {
358  FuseConvolution2dLayer<Convolution2dLayer>(optimizationViews,
359  baseLayer,
360  activationLayer,
361  activationDesc,
362  name);
363  untouched.erase(baseLayer->GetGuid());
364  untouched.erase(activationLayer->GetGuid());
365  }
366  }
367  else if (base.GetType() == LayerType::DepthwiseConvolution2d)
368  {
369  DepthwiseConvolution2dLayer* baseLayer =
370  PolymorphicDowncast<DepthwiseConvolution2dLayer*>(&base);
371 
372  Optional<TensorInfo> biases;
373 
374  if (baseLayer->GetParameters().m_BiasEnabled)
375  {
376  biases = baseLayer->m_Bias->GetTensorInfo();
377  }
378 
381  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
382  baseLayer->GetParameters(),
383  baseLayer->m_Weight->GetTensorInfo(),
384  biases,
385  &activationDesc);
386 
387  if (status)
388  {
389  FuseDepthwiseConvolution2dLayer<DepthwiseConvolution2dLayer>(optimizationViews,
390  baseLayer,
391  activationLayer,
392  activationDesc,
393  name);
394  untouched.erase(baseLayer->GetGuid());
395  untouched.erase(activationLayer->GetGuid());
396  }
397  }
398  else if (base.GetType() == LayerType::FullyConnected)
399  {
400  FullyConnectedLayer* baseLayer = PolymorphicDowncast<FullyConnectedLayer*>(&base);
401 
402  Optional<TensorInfo> biases;
403 
404  if (baseLayer->GetParameters().m_BiasEnabled)
405  {
406  biases = baseLayer->m_Bias->GetTensorInfo();
407  }
408 
411  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
412  baseLayer->m_Weight->GetTensorInfo(),
413  biases,
414  baseLayer->GetParameters(),
415  &activationDesc);
416 
417  if (status)
418  {
419  FuseFullyConnectedLayer<FullyConnectedLayer>(optimizationViews,
420  baseLayer,
421  activationLayer,
422  activationDesc,
423  name);
424  untouched.erase(baseLayer->GetGuid());
425  untouched.erase(activationLayer->GetGuid());
426  }
427  }
428  else if (base.GetType() == LayerType::BatchNormalization)
429  {
430  BatchNormalizationLayer* baseLayer =
431  PolymorphicDowncast<BatchNormalizationLayer*>(&base);
432 
435  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
436  baseLayer->m_Mean->GetTensorInfo(),
437  baseLayer->m_Variance->GetTensorInfo(),
438  baseLayer->m_Beta->GetTensorInfo(),
439  baseLayer->m_Gamma->GetTensorInfo(),
440  baseLayer->GetParameters(),
441  &activationDesc);
442 
443  if (status)
444  {
445  BatchNormalizationLayer* replacementLayer =
446  FuseBatchNormalizationLayer<BatchNormalizationLayer>(optimizationViews,
447  baseLayer,
448  activationLayer,
449  activationDesc,
450  name);
451 
452  replacementLayer->m_Beta = std::move(baseLayer->m_Beta);
453  replacementLayer->m_Gamma = std::move(baseLayer->m_Gamma);
454  replacementLayer->m_Mean = std::move(baseLayer->m_Mean);
455  replacementLayer->m_Variance = std::move(baseLayer->m_Variance);
456  untouched.erase(baseLayer->GetGuid());
457  untouched.erase(activationLayer->GetGuid());
458  }
459  }
460  else if (base.GetType() == LayerType::Addition)
461  {
462  AdditionLayer* baseLayer = PolymorphicDowncast<AdditionLayer*>(&base);
463 
467  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
468  &activationDesc);
469 
470  if (status)
471  {
472  FuseAdditionLayer<AdditionLayer>(optimizationViews,
473  baseLayer,
474  activationLayer,
475  activationDesc,
476  name);
477  untouched.erase(baseLayer->GetGuid());
478  untouched.erase(activationLayer->GetGuid());
479  }
480  }
481  else if (base.GetType() == LayerType::Division)
482  {
483  DivisionLayer* baseLayer = PolymorphicDowncast<DivisionLayer*>(&base);
484 
488  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
489  &activationDesc);
490 
491  if (status)
492  {
493  FuseDivisionLayer<DivisionLayer>(optimizationViews,
494  baseLayer,
495  activationLayer,
496  activationDesc,
497  name);
498  untouched.erase(baseLayer->GetGuid());
499  untouched.erase(activationLayer->GetGuid());
500  }
501  }
502  else if (base.GetType() == LayerType::Multiplication)
503  {
504  MultiplicationLayer* baseLayer = PolymorphicDowncast<MultiplicationLayer*>(&base);
505 
509  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
510  &activationDesc);
511 
512  if (status)
513  {
514  FuseMultiplicationLayer<MultiplicationLayer>(optimizationViews,
515  baseLayer,
516  activationLayer,
517  activationDesc,
518  name);
519  untouched.erase(baseLayer->GetGuid());
520  untouched.erase(activationLayer->GetGuid());
521  }
522  }
523  else if (base.GetType() == LayerType::Subtraction)
524  {
525  SubtractionLayer* baseLayer = PolymorphicDowncast<SubtractionLayer*>(&base);
526 
530  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
531  &activationDesc);
532 
533  if (status)
534  {
535  FuseSubtractionLayer<SubtractionLayer>(optimizationViews,
536  baseLayer,
537  activationLayer,
538  activationDesc,
539  name);
540  untouched.erase(baseLayer->GetGuid());
541  untouched.erase(activationLayer->GetGuid());
542  }
543  }
544  }
545  }
546  }
547  }
548  }
549 
550  // Separate reduce layer with multiple axes into multiple reduce layers with 1 axis.
551  if (base.GetType() == LayerType::Reduce)
552  {
553  ReduceLayer* baseLayer = PolymorphicDowncast<ReduceLayer*>(&base);
554  ReduceDescriptor reduceDescriptor = baseLayer->GetParameters();
555 
556  if (!reduceDescriptor.m_vAxis.empty() && reduceDescriptor.m_vAxis.size() > 1)
557  {
558  // Add new layers to the graph and connect them.
559  std::vector<IConnectableLayer*> layers = ChainReduceLayers<ReduceLayer>(optimizationViews,
560  baseLayer,
561  reduceDescriptor);
562 
563  // Replace existing baselayer with new subgraph.
564  ReplaceLayers<ReduceLayer>(optimizationViews, baseLayer, layers);
565  untouched.erase(baseLayer->GetGuid());
566  }
567  }
568  }
569 
570  if (optimizationViews.GetSubstitutions().empty())
571  {
572  optimizationViews.AddUntouchedSubgraph(SubgraphView(subgraph));
573  }
574  else
575  {
576  ReportUntouchedLayers(optimizationViews, untouched);
577  }
578 
579  return optimizationViews;
580 }
581 
582 } // namespace armnn
arm_compute::Status ClAdditionValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
bool m_BiasEnabled
Enable/disable bias.
void RegisterMemoryManager(std::shared_ptr< IMemoryManager > memoryManger)
Register a memory manager with shared ownership.
IConnectableLayerIterator endIConnectable()
static const FactoryId & GetIdStatic()
This layer represents a batch normalization operation.
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
bool m_BiasEnabled
Enable/disable bias.
arm_compute::Status ClDivisionWorkloadValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
This layer represents a depthwise convolution 2d operation.
constexpr const char * ClBackendId()
Definition: ClBackendId.hpp:10
std::vector< BackendOptions > ModelOptions
void RegisterFactory(std::unique_ptr< ITensorHandleFactory > allocator)
Register a TensorHandleFactory and transfer ownership.
void ReportUntouchedLayers(OptimizationViews &optimizationViews, std::map< LayerGuid, Layer *> untouched)
arm_compute::Status ClSubtractionValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
IConnectableLayerIterator beginIConnectable()
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store Weight values.
std::shared_ptr< ConstTensorHandle > m_Mean
A unique pointer to store Mean values.
std::shared_ptr< ClBackendCustomAllocatorWrapper > m_CustomAllocator
Definition: ClBackend.hpp:299
unsigned int MemorySourceFlags
Copyright (c) 2021 ARM Limited and Contributors.
arm_compute::Status ClConvolution2dWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const Convolution2dDescriptor &descriptor, const TensorInfo &weights, const Optional< TensorInfo > &biases, bool isFastMathEnabled, const ActivationDescriptor *activationDescriptor)
const Parameters & GetParameters() const override
If the layer has a descriptor return it.
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
Definition: ClBackend.cpp:51
This layer represents a reduction operation.
Definition: ReduceLayer.hpp:13
std::shared_ptr< ConstTensorHandle > m_Beta
A unique pointer to store Beta values.
void RegisterTensorHandleFactories(TensorHandleFactoryRegistry &registry) override
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFa...
Definition: ClBackend.cpp:176
The SubgraphView class represents a subgraph of a Graph.
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
Definition: ClBackend.cpp:247
void RegisterCopyAndImportFactoryPair(ITensorHandleFactory::FactoryId copyFactoryId, ITensorHandleFactory::FactoryId importFactoryId)
Register a pair of TensorHandleFactory Id for Memory Copy and TensorHandleFactory Id for Memory Impor...
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:321
std::unique_ptr< armnn::profiling::IBackendProfiling > IBackendProfilingPtr
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
Definition: ClBackend.cpp:276
This layer represents a fully connected operation.
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store Weight values.
std::shared_ptr< IBackendModelContext > IBackendSpecificModelContextPtr
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
A ReduceDescriptor for the REDUCE operators.
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
Definition: ClBackend.cpp:236
bool m_BiasEnabled
Enable/disable bias.
std::shared_ptr< ConstTensorHandle > m_Bias
A unique pointer to store Bias values.
arm_compute::Status ClMultiplicationWorkloadValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const override
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
Definition: ClBackend.cpp:170
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
Definition: Layer.hpp:270
Status
enumeration
Definition: Types.hpp:29
const OutputSlot * GetConnectedOutputSlot() const
Definition: Layer.hpp:56
std::shared_ptr< ConstTensorHandle > m_Gamma
A unique pointer to store Gamma values.
arm_compute::Status ClFullyConnectedWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const TensorInfo &weights, const Optional< TensorInfo > &biases, const FullyConnectedDescriptor &descriptor, const ActivationDescriptor *activationDescriptor)
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:36
arm_compute::Status ClBatchNormalizationValidate(const TensorInfo &input, const TensorInfo &output, const TensorInfo &mean, const TensorInfo &var, const TensorInfo &beta, const TensorInfo &gamma, const BatchNormalizationDescriptor &descriptor, const ActivationDescriptor *activationDescriptor)
void AddUntouchedSubgraph(SubgraphView &&subgraph)
std::shared_ptr< ConstTensorHandle > m_Variance
A unique pointer to store Variance values.
std::shared_ptr< ConstTensorHandle > m_Bias
A unique pointer to store Bias values.
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
Definition: ClBackend.cpp:60
This layer represents an addition operation.
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
const Substitutions & GetSubstitutions() const
This layer represents a subtraction operation.
std::vector< OutputSlot >::iterator BeginOutputSlots()
Definition: Layer.hpp:250
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
Definition: ClBackend.cpp:253
std::shared_ptr< ConstTensorHandle > m_Bias
A unique pointer to store Bias values.
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store Weight values.
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
Definition: ClBackend.cpp:241
bool m_UsingCustomAllocator
Definition: ClBackend.hpp:300
This layer represents a division operation.
std::vector< OutputSlot >::iterator EndOutputSlots()
Definition: Layer.hpp:251
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:316
This layer represents a convolution 2d operation.
The ClBackendModelContext is used to pass in CL specific backend ModelOptions.
This layer represents a multiplication operation.
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
Definition: ClBackend.cpp:271
const TensorInfo & GetTensorInfo() const override
Definition: Layer.cpp:66
static const BackendId & GetIdStatic()
Definition: ClBackend.cpp:45
arm_compute::Status ClDepthwiseConvolutionWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const DepthwiseConvolution2dDescriptor &descriptor, const TensorInfo &weights, const Optional< TensorInfo > &biases, const ActivationDescriptor *activationDescriptor)
std::shared_ptr< armnn::profiling::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we&#39;ll keep it in the backend namespace...
std::shared_ptr< T > GetAdditionalInformation() const
Definition: Layer.hpp:347
LayerGuid GetGuid() const final
Returns the unique id of the layer.
Definition: Layer.hpp:327
std::unique_ptr< IBackendContext > IBackendContextPtr