ArmNN
 22.05
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(modelOptions);
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->GetInputSlot(2).GetConnectedOutputSlot()->GetTensorInfo();
345  }
346 
349  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
350  baseLayer->GetParameters(),
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->GetInputSlot(2).GetConnectedOutputSlot()->GetTensorInfo();
377  }
378 
381  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
382  baseLayer->GetParameters(),
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  FullyConnectedDescriptor descriptor = baseLayer->GetParameters();
402 
403  // As bias is optional only try to get TensorInfo from input if bias is enabled.
404  Optional<TensorInfo> biases;
405  if (descriptor.m_BiasEnabled)
406  {
407  biases = baseLayer->GetInputSlot(2).GetConnectedOutputSlot()->GetTensorInfo();
408  }
409 
412  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
414  biases,
415  baseLayer->GetParameters(),
416  &activationDesc);
417 
418  if (status)
419  {
420  FuseFullyConnectedLayer<FullyConnectedLayer>(optimizationViews,
421  baseLayer,
422  activationLayer,
423  activationDesc,
424  name);
425  untouched.erase(baseLayer->GetGuid());
426  untouched.erase(activationLayer->GetGuid());
427  }
428  }
429  else if (base.GetType() == LayerType::BatchNormalization)
430  {
431  BatchNormalizationLayer* baseLayer =
432  PolymorphicDowncast<BatchNormalizationLayer*>(&base);
433 
436  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
437  baseLayer->m_Mean->GetTensorInfo(),
438  baseLayer->m_Variance->GetTensorInfo(),
439  baseLayer->m_Beta->GetTensorInfo(),
440  baseLayer->m_Gamma->GetTensorInfo(),
441  baseLayer->GetParameters(),
442  &activationDesc);
443 
444  if (status)
445  {
446  BatchNormalizationLayer* replacementLayer =
447  FuseBatchNormalizationLayer<BatchNormalizationLayer>(optimizationViews,
448  baseLayer,
449  activationLayer,
450  activationDesc,
451  name);
452 
453  replacementLayer->m_Beta = std::move(baseLayer->m_Beta);
454  replacementLayer->m_Gamma = std::move(baseLayer->m_Gamma);
455  replacementLayer->m_Mean = std::move(baseLayer->m_Mean);
456  replacementLayer->m_Variance = std::move(baseLayer->m_Variance);
457  untouched.erase(baseLayer->GetGuid());
458  untouched.erase(activationLayer->GetGuid());
459  }
460  }
461  else if (base.GetType() == LayerType::Addition)
462  {
463  AdditionLayer* baseLayer = PolymorphicDowncast<AdditionLayer*>(&base);
464 
468  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
469  &activationDesc);
470 
471  if (status)
472  {
473  FuseAdditionLayer<AdditionLayer>(optimizationViews,
474  baseLayer,
475  activationLayer,
476  activationDesc,
477  name);
478  untouched.erase(baseLayer->GetGuid());
479  untouched.erase(activationLayer->GetGuid());
480  }
481  }
482  else if (base.GetType() == LayerType::Division)
483  {
484  DivisionLayer* baseLayer = PolymorphicDowncast<DivisionLayer*>(&base);
485 
489  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
490  &activationDesc);
491 
492  if (status)
493  {
494  FuseDivisionLayer<DivisionLayer>(optimizationViews,
495  baseLayer,
496  activationLayer,
497  activationDesc,
498  name);
499  untouched.erase(baseLayer->GetGuid());
500  untouched.erase(activationLayer->GetGuid());
501  }
502  }
503  else if (base.GetType() == LayerType::Multiplication)
504  {
505  MultiplicationLayer* baseLayer = PolymorphicDowncast<MultiplicationLayer*>(&base);
506 
510  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
511  &activationDesc);
512 
513  if (status)
514  {
515  FuseMultiplicationLayer<MultiplicationLayer>(optimizationViews,
516  baseLayer,
517  activationLayer,
518  activationDesc,
519  name);
520  untouched.erase(baseLayer->GetGuid());
521  untouched.erase(activationLayer->GetGuid());
522  }
523  }
524  else if (base.GetType() == LayerType::Subtraction)
525  {
526  SubtractionLayer* baseLayer = PolymorphicDowncast<SubtractionLayer*>(&base);
527 
531  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
532  &activationDesc);
533 
534  if (status)
535  {
536  FuseSubtractionLayer<SubtractionLayer>(optimizationViews,
537  baseLayer,
538  activationLayer,
539  activationDesc,
540  name);
541  untouched.erase(baseLayer->GetGuid());
542  untouched.erase(activationLayer->GetGuid());
543  }
544  }
545  }
546  }
547  }
548  }
549  }
550 
551  // Separate reduce layer with multiple axes into multiple reduce layers with 1 axis.
552  if (base.GetType() == LayerType::Reduce)
553  {
554  ReduceLayer* baseLayer = PolymorphicDowncast<ReduceLayer*>(&base);
555  ReduceDescriptor reduceDescriptor = baseLayer->GetParameters();
556 
557  if (!reduceDescriptor.m_vAxis.empty() && reduceDescriptor.m_vAxis.size() > 1)
558  {
559  // Add new layers to the graph and connect them.
560  std::vector<IConnectableLayer*> layers = ChainReduceLayers<ReduceLayer>(optimizationViews,
561  baseLayer,
562  reduceDescriptor);
563 
564  // Replace existing baselayer with new subgraph.
565  ReplaceLayers<ReduceLayer>(optimizationViews, baseLayer, layers);
566  untouched.erase(baseLayer->GetGuid());
567  }
568  }
569  }
570 
571  if (optimizationViews.GetSubstitutions().empty())
572  {
573  optimizationViews.AddUntouchedSubgraph(SubgraphView(subgraph));
574  }
575  else
576  {
577  ReportUntouchedLayers(optimizationViews, untouched);
578  }
579 
580  return optimizationViews;
581 }
582 
583 } // 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_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:322
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
Definition: ClBackend.cpp:276
This layer represents a fully connected operation.
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
A FullyConnectedDescriptor for the FullyConnectedLayer.
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:271
Status
enumeration
Definition: Types.hpp:42
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< arm::pipe::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we&#39;ll keep it in the backend namespace...
std::shared_ptr< ConstTensorHandle > m_Variance
A unique pointer to store Variance 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
std::unique_ptr< arm::pipe::IBackendProfiling > IBackendProfilingPtr
This layer represents a subtraction operation.
std::vector< OutputSlot >::iterator BeginOutputSlots()
Definition: Layer.hpp:251
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
Definition: ClBackend.cpp:253
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:252
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:317
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:92
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< T > GetAdditionalInformation() const
Definition: Layer.hpp:353
LayerGuid GetGuid() const final
Returns the unique id of the layer.
Definition: Layer.hpp:328
std::unique_ptr< IBackendContext > IBackendContextPtr