ArmNN
 20.11
ClBackend Class Reference

#include <ClBackend.hpp>

Inheritance diagram for ClBackend:
IBackendInternal IBackend

Public Member Functions

 ClBackend ()=default
 
 ~ClBackend ()=default
 
const BackendIdGetId () const override
 
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager () const override
 
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory (const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
 
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory (TensorHandleFactoryRegistry &registry) const override
 
IWorkloadFactoryPtr CreateWorkloadFactory (const IMemoryManagerSharedPtr &memoryManager, const ModelOptions &modelOptions) const override
 
IWorkloadFactoryPtr CreateWorkloadFactory (class TensorHandleFactoryRegistry &tensorHandleFactoryRegistry, const ModelOptions &modelOptions) const override
 
std::vector< ITensorHandleFactory::FactoryIdGetHandleFactoryPreferences () const override
 (Optional) Returns a vector of supported TensorHandleFactory ids in preference order. More...
 
void RegisterTensorHandleFactories (TensorHandleFactoryRegistry &registry) override
 (Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFactory::CreateTensor()/IWorkloadFactory::CreateSubtensor() methods must be implemented. More...
 
IBackendInternal::IBackendContextPtr CreateBackendContext (const IRuntime::CreationOptions &) const override
 Create the runtime context of the backend. More...
 
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext (const IRuntime::CreationOptions &, IBackendProfilingPtr &backendProfiling) override
 Create context specifically used for profiling interaction from backends. More...
 
IBackendInternal::Optimizations GetOptimizations () const override
 
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport () const override
 
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport (const ModelOptions &modelOptions) const override
 
OptimizationViews OptimizeSubgraphView (const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
 
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext (const ModelOptions &modelOptions) const override
 
- Public Member Functions inherited from IBackendInternal
 ~IBackendInternal () override=default
 Allow backends created by the factory function to be destroyed through IBackendInternal. More...
 
virtual ISubGraphConverterPtr CreateSubGraphConverter (const std::shared_ptr< SubGraph > &subGraph) const
 
virtual SubGraphUniquePtr OptimizeSubGraph (const SubGraph &subGraph, bool &optimizationAttempted) const
 
virtual OptimizationViews OptimizeSubgraphView (const SubgraphView &subgraph) const
 
bool SupportsTensorAllocatorAPI () const
 
ITensorHandleFactory::FactoryId GetBackwardCompatibleFavoriteHandleFactory ()
 

Static Public Member Functions

static const BackendIdGetIdStatic ()
 
- Static Public Member Functions inherited from IBackendInternal
static constexpr BackendVersion GetApiVersion ()
 Returns the version of the Backend API. More...
 

Additional Inherited Members

- Public Types inherited from IBackendInternal
using IWorkloadFactoryPtr = std::unique_ptr< IWorkloadFactory >
 
using IBackendContextPtr = std::unique_ptr< IBackendContext >
 
using IBackendProfilingContextPtr = std::shared_ptr< armnn::profiling::IBackendProfilingContext >
 This is the bridge between backend and backend profiling we'll keep it in the backend namespace. More...
 
using IBackendProfilingPtr = std::unique_ptr< armnn::profiling::IBackendProfiling >
 
using OptimizationPtr = std::unique_ptr< Optimization >
 
using Optimizations = std::vector< OptimizationPtr >
 
using ILayerSupportSharedPtr = std::shared_ptr< ILayerSupport >
 
using IBackendSpecificModelContextPtr = std::shared_ptr< IBackendModelContext >
 
using IMemoryManagerUniquePtr = std::unique_ptr< IMemoryManager >
 
using IMemoryManagerSharedPtr = std::shared_ptr< IMemoryManager >
 
using GraphUniquePtr = std::unique_ptr< Graph >
 
using SubgraphViewUniquePtr = std::unique_ptr< SubgraphView >
 
using supported = std::unique_ptr< ISubGraphConverter >
 
using instead = std::unique_ptr< SubGraph >
 
- Protected Member Functions inherited from IBackendInternal
 IBackendInternal ()=default
 Creation must be done through a specific backend interface. More...
 
- Protected Member Functions inherited from IBackend
 IBackend ()
 
virtual ~IBackend ()
 

Detailed Description

Definition at line 12 of file ClBackend.hpp.

Constructor & Destructor Documentation

◆ ClBackend()

ClBackend ( )
default

◆ ~ClBackend()

~ClBackend ( )
default

Member Function Documentation

◆ CreateBackendContext()

IBackendInternal::IBackendContextPtr CreateBackendContext ( const IRuntime::CreationOptions ) const
overridevirtual

Create the runtime context of the backend.

Implementations may return a default-constructed IBackendContextPtr if no context is needed at runtime. Implementations must throw BackendUnavailableException if the backend cannot be used (for example, necessary accelerator hardware is not present). The default implementation always returns a default-constructed pointer.

Reimplemented from IBackendInternal.

Definition at line 104 of file ClBackend.cpp.

Referenced by ClBackend::GetId().

105 {
106  return IBackendContextPtr{new ClBackendContext{options}};
107 }
std::unique_ptr< IBackendContext > IBackendContextPtr

◆ CreateBackendProfilingContext()

IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext ( const IRuntime::CreationOptions creationOptions,
IBackendProfilingPtr backendProfiling 
)
overridevirtual

Create context specifically used for profiling interaction from backends.

Reimplemented from IBackendInternal.

Definition at line 109 of file ClBackend.cpp.

Referenced by ClBackend::GetId().

111 {
113 }
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...

◆ CreateBackendSpecificModelContext()

IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext ( const ModelOptions modelOptions) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 120 of file ClBackend.cpp.

Referenced by ClBackend::CreateWorkloadFactory(), ClBackend::GetId(), ClBackend::GetLayerSupport(), and ClBackend::OptimizeSubgraphView().

122 {
123  return IBackendSpecificModelContextPtr{new ClBackendModelContext{modelOptions}};
124 }
std::shared_ptr< IBackendModelContext > IBackendSpecificModelContextPtr

◆ CreateMemoryManager()

IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager ( ) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 48 of file ClBackend.cpp.

Referenced by ClBackend::GetId().

49 {
50  return std::make_unique<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
51 }

◆ CreateWorkloadFactory() [1/4]

IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory ( const IBackendInternal::IMemoryManagerSharedPtr memoryManager = nullptr) const
overridevirtual

Implements IBackendInternal.

Definition at line 53 of file ClBackend.cpp.

Referenced by ClBackend::GetId().

55 {
56  return std::make_unique<ClWorkloadFactory>(
57  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager));
58 }

◆ CreateWorkloadFactory() [2/4]

IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory ( TensorHandleFactoryRegistry registry) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 67 of file ClBackend.cpp.

References TensorHandleFactoryRegistry::RegisterFactory(), and TensorHandleFactoryRegistry::RegisterMemoryManager().

69 {
70  auto memoryManager = std::make_shared<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
71 
72  registry.RegisterMemoryManager(memoryManager);
73  registry.RegisterFactory(std::make_unique<ClTensorHandleFactory>(memoryManager));
74 
75  return std::make_unique<ClWorkloadFactory>(
76  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager));
77 }

◆ CreateWorkloadFactory() [3/4]

IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory ( const IMemoryManagerSharedPtr memoryManager,
const ModelOptions modelOptions 
) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 60 of file ClBackend.cpp.

References ClBackend::CreateBackendSpecificModelContext().

62 {
63  return std::make_unique<ClWorkloadFactory>(
64  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager), CreateBackendSpecificModelContext(modelOptions));
65 }
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
Definition: ClBackend.cpp:120

◆ CreateWorkloadFactory() [4/4]

IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory ( class TensorHandleFactoryRegistry tensorHandleFactoryRegistry,
const ModelOptions modelOptions 
) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 79 of file ClBackend.cpp.

References ClBackend::CreateBackendSpecificModelContext(), TensorHandleFactoryRegistry::RegisterFactory(), and TensorHandleFactoryRegistry::RegisterMemoryManager().

81 {
82  auto memoryManager = std::make_shared<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
83 
84  registry.RegisterMemoryManager(memoryManager);
85  registry.RegisterFactory(std::make_unique<ClTensorHandleFactory>(memoryManager));
86 
87  return std::make_unique<ClWorkloadFactory>(
88  PolymorphicPointerDowncast<ClMemoryManager>(memoryManager), CreateBackendSpecificModelContext(modelOptions));
89 }
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
Definition: ClBackend.cpp:120

◆ GetHandleFactoryPreferences()

std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences ( ) const
overridevirtual

(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.

Reimplemented from IBackendInternal.

Definition at line 91 of file ClBackend.cpp.

References ClTensorHandleFactory::GetIdStatic().

Referenced by ClBackend::GetId().

92 {
93  return std::vector<ITensorHandleFactory::FactoryId> {ClTensorHandleFactory::GetIdStatic()};
94 }
static const FactoryId & GetIdStatic()

◆ GetId()

◆ GetIdStatic()

const BackendId & GetIdStatic ( )
static

Definition at line 42 of file ClBackend.cpp.

References armnn::ClBackendId().

Referenced by ClBackend::GetId().

43 {
44  static const BackendId s_Id{ClBackendId()};
45  return s_Id;
46 }
constexpr const char * ClBackendId()
Definition: ClBackendId.hpp:10

◆ GetLayerSupport() [1/2]

IBackendInternal::ILayerSupportSharedPtr GetLayerSupport ( ) const
overridevirtual

Implements IBackendInternal.

Definition at line 126 of file ClBackend.cpp.

Referenced by ClBackend::GetId().

127 {
128  static ILayerSupportSharedPtr layerSupport
129  {
131  };
132  return layerSupport;
133 }
std::shared_ptr< IBackendModelContext > IBackendSpecificModelContextPtr
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr

◆ GetLayerSupport() [2/2]

IBackendInternal::ILayerSupportSharedPtr GetLayerSupport ( const ModelOptions modelOptions) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 135 of file ClBackend.cpp.

References ClBackend::CreateBackendSpecificModelContext().

136 {
137  static ILayerSupportSharedPtr layerSupport
138  {
139  new ClLayerSupport(CreateBackendSpecificModelContext(modelOptions))
140  };
141  return layerSupport;
142 }
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
Definition: ClBackend.cpp:120
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr

◆ GetOptimizations()

IBackendInternal::Optimizations GetOptimizations ( ) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 115 of file ClBackend.cpp.

Referenced by ClBackend::GetId().

116 {
117  return Optimizations{};
118 }
std::vector< OptimizationPtr > Optimizations

◆ OptimizeSubgraphView()

OptimizationViews OptimizeSubgraphView ( const SubgraphView subgraph,
const ModelOptions modelOptions 
) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 144 of file ClBackend.cpp.

References armnn::Activation, armnn::Addition, OptimizationViews::AddUntouchedSubgraph(), armnn::BatchNormalization, SubgraphView::begin(), Layer::BeginOutputSlots(), armnn::ClAdditionValidate(), armnn::ClBatchNormalizationValidate(), armnn::ClConvolution2dWorkloadValidate(), armnn::ClDepthwiseConvolutionWorkloadValidate(), armnn::ClDivisionWorkloadValidate(), armnn::ClFullyConnectedWorkloadValidate(), armnn::ClMultiplicationWorkloadValidate(), armnn::ClSubtractionValidate(), armnn::Convolution2d, ClBackend::CreateBackendSpecificModelContext(), armnn::DepthwiseConvolution2d, armnn::Division, SubgraphView::end(), Layer::EndOutputSlots(), armnn::FullyConnected, Layer::GetAdditionalInformation(), InputSlot::GetConnectedOutputSlot(), Layer::GetGuid(), Layer::GetInputSlot(), Layer::GetName(), LayerWithParameters< Parameters >::GetParameters(), OptimizationViews::GetSubstitutions(), OutputSlot::GetTensorInfo(), Layer::GetType(), ClBackendModelContext::IsFastMathEnabled(), BatchNormalizationLayer::m_Beta, FullyConnectedLayer::m_Bias, DepthwiseConvolution2dLayer::m_Bias, Convolution2dLayer::m_Bias, Convolution2dDescriptor::m_BiasEnabled, DepthwiseConvolution2dDescriptor::m_BiasEnabled, BatchNormalizationLayer::m_Gamma, BatchNormalizationLayer::m_Mean, BatchNormalizationLayer::m_Variance, FullyConnectedLayer::m_Weight, DepthwiseConvolution2dLayer::m_Weight, Convolution2dLayer::m_Weight, armnn::Multiplication, armnn::ReportUntouchedLayers(), and armnn::Subtraction.

Referenced by ClBackend::GetId().

146 {
147  OptimizationViews optimizationViews;
148 
149  auto it = subgraph.end();
150  bool isFastMathEnabled = false;
151  std::map<LayerGuid, Layer*> untouched;
152 
153  while (it != subgraph.begin())
154  {
155  --it;
156  Layer& base = **it;
157  untouched.insert({base.GetGuid(), &base});
158  }
159 
160  it = subgraph.end();
161 #if defined(ARMCOMPUTECL_ENABLED)
163 
164  if (modelContextPtr)
165  {
166  auto clModelOptions = dynamic_cast<ClBackendModelContext*>(modelContextPtr.get());
167  if (clModelOptions)
168  {
169  isFastMathEnabled = clModelOptions->IsFastMathEnabled();
170  }
171  }
172 #endif
173  while (it != subgraph.begin())
174  {
175  --it;
176  Layer& base = **it;
177 
178  if ((base.GetType() == LayerType::DepthwiseConvolution2d || base.GetType() == LayerType::Convolution2d
179  || base.GetType() == LayerType::BatchNormalization || base.GetType() == LayerType::FullyConnected
180  || base.GetType() == LayerType::Addition || base.GetType() == LayerType::Multiplication
181  || base.GetType() == LayerType::Subtraction || base.GetType() == LayerType::Division)
182  && (base.GetAdditionalInformation<ActivationDescriptor>() == nullptr))
183  {
184  for (auto output = base.BeginOutputSlots(); output != base.EndOutputSlots(); ++output)
185  {
186  if (output->GetNumConnections() == 1)
187  {
188  for (auto&& childInput : output->GetConnections())
189  {
190  if (childInput->GetOwningLayer().GetType() == LayerType::Activation)
191  {
192  Layer& child = childInput->GetOwningLayer();
193 
194  auto* activationLayer = PolymorphicDowncast<ActivationLayer*>(&child);
195 
196  const std::string name = std::string("fused-") + child.GetName() + std::string("-into-") +
197  base.GetName();
198 
199  // Get params from activation layer
200  ActivationDescriptor activationDesc = activationLayer->GetParameters();
201 
202  if (base.GetType() == LayerType::Convolution2d)
203  {
204  Convolution2dLayer* baseLayer = PolymorphicDowncast<Convolution2dLayer*>(&base);
205 
206  Optional<TensorInfo> biases;
207 
208  if (baseLayer->GetParameters().m_BiasEnabled)
209  {
210  biases = baseLayer->m_Bias->GetTensorInfo();
211  }
212 
214  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
215  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
216  baseLayer->GetParameters(),
217  baseLayer->m_Weight->GetTensorInfo(),
218  biases,
219  isFastMathEnabled,
220  &activationDesc);
221 
222  if (status)
223  {
224  FuseLayerWithWeightsAndBiases<Convolution2dLayer>(optimizationViews,
225  baseLayer,
226  activationLayer,
227  activationDesc,
228  name);
229  untouched.erase(baseLayer->GetGuid());
230  untouched.erase(activationLayer->GetGuid());
231  }
232  }
233  else if (base.GetType() == LayerType::DepthwiseConvolution2d)
234  {
235  DepthwiseConvolution2dLayer* baseLayer =
236  PolymorphicDowncast<DepthwiseConvolution2dLayer*>(&base);
237 
238  Optional<TensorInfo> biases;
239 
240  if (baseLayer->GetParameters().m_BiasEnabled)
241  {
242  biases = baseLayer->m_Bias->GetTensorInfo();
243  }
244 
246  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
247  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
248  baseLayer->GetParameters(),
249  baseLayer->m_Weight->GetTensorInfo(),
250  biases,
251  &activationDesc);
252 
253  if (status)
254  {
255  FuseLayerWithWeightsAndBiases<DepthwiseConvolution2dLayer>(optimizationViews,
256  baseLayer,
257  activationLayer,
258  activationDesc,
259  name);
260  untouched.erase(baseLayer->GetGuid());
261  untouched.erase(activationLayer->GetGuid());
262  }
263  }
264  else if (base.GetType() == LayerType::FullyConnected)
265  {
266  FullyConnectedLayer* baseLayer = PolymorphicDowncast<FullyConnectedLayer*>(&base);
267 
269  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
270  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
271  baseLayer->m_Weight->GetTensorInfo(),
272  baseLayer->m_Bias->GetTensorInfo(),
273  baseLayer->GetParameters(),
274  &activationDesc);
275 
276  if (status)
277  {
278  FuseLayerWithWeightsAndBiases<FullyConnectedLayer>(optimizationViews,
279  baseLayer,
280  activationLayer,
281  activationDesc,
282  name);
283  untouched.erase(baseLayer->GetGuid());
284  untouched.erase(activationLayer->GetGuid());
285  }
286  }
287  else if (base.GetType() == LayerType::BatchNormalization)
288  {
289  BatchNormalizationLayer* baseLayer =
290  PolymorphicDowncast<BatchNormalizationLayer*>(&base);
291 
293  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
294  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
295  baseLayer->m_Mean->GetTensorInfo(),
296  baseLayer->m_Variance->GetTensorInfo(),
297  baseLayer->m_Beta->GetTensorInfo(),
298  baseLayer->m_Gamma->GetTensorInfo(),
299  baseLayer->GetParameters(),
300  &activationDesc);
301 
302  if (status)
303  {
304  BatchNormalizationLayer* replacementLayer =
305  FuseLayerWithParameters<BatchNormalizationLayer>(optimizationViews,
306  baseLayer,
307  activationLayer,
308  activationDesc,
309  name);
310 
311  replacementLayer->m_Beta = std::move(baseLayer->m_Beta);
312  replacementLayer->m_Gamma = std::move(baseLayer->m_Gamma);
313  replacementLayer->m_Mean = std::move(baseLayer->m_Mean);
314  replacementLayer->m_Variance = std::move(baseLayer->m_Variance);
315  untouched.erase(baseLayer->GetGuid());
316  untouched.erase(activationLayer->GetGuid());
317  }
318  }
319  else if (base.GetType() == LayerType::Addition)
320  {
321  AdditionLayer* baseLayer = PolymorphicDowncast<AdditionLayer*>(&base);
322 
324  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
325  baseLayer->GetInputSlot(1).GetConnectedOutputSlot()->GetTensorInfo(),
326  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
327  &activationDesc);
328 
329  if (status)
330  {
331  FuseLayerWithoutParameters<AdditionLayer>(optimizationViews,
332  baseLayer,
333  activationLayer,
334  activationDesc,
335  name);
336  untouched.erase(baseLayer->GetGuid());
337  untouched.erase(activationLayer->GetGuid());
338  }
339  }
340  else if (base.GetType() == LayerType::Division)
341  {
342  DivisionLayer* baseLayer = PolymorphicDowncast<DivisionLayer*>(&base);
343 
345  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
346  baseLayer->GetInputSlot(1).GetConnectedOutputSlot()->GetTensorInfo(),
347  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
348  &activationDesc);
349 
350  if (status)
351  {
352  FuseLayerWithoutParameters<DivisionLayer>(optimizationViews,
353  baseLayer,
354  activationLayer,
355  activationDesc,
356  name);
357  untouched.erase(baseLayer->GetGuid());
358  untouched.erase(activationLayer->GetGuid());
359  }
360  }
361  else if (base.GetType() == LayerType::Multiplication)
362  {
363  MultiplicationLayer* baseLayer = PolymorphicDowncast<MultiplicationLayer*>(&base);
364 
366  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
367  baseLayer->GetInputSlot(1).GetConnectedOutputSlot()->GetTensorInfo(),
368  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
369  &activationDesc);
370 
371  if (status)
372  {
373  FuseLayerWithoutParameters<MultiplicationLayer>(optimizationViews,
374  baseLayer,
375  activationLayer,
376  activationDesc,
377  name);
378  untouched.erase(baseLayer->GetGuid());
379  untouched.erase(activationLayer->GetGuid());
380  }
381  }
382  else if (base.GetType() == LayerType::Subtraction)
383  {
384  SubtractionLayer* baseLayer = PolymorphicDowncast<SubtractionLayer*>(&base);
385 
387  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
388  baseLayer->GetInputSlot(1).GetConnectedOutputSlot()->GetTensorInfo(),
389  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
390  &activationDesc);
391 
392  if (status)
393  {
394  FuseLayerWithoutParameters<SubtractionLayer>(optimizationViews,
395  baseLayer,
396  activationLayer,
397  activationDesc,
398  name);
399  untouched.erase(baseLayer->GetGuid());
400  untouched.erase(activationLayer->GetGuid());
401  }
402  }
403  }
404  }
405  }
406  }
407  }
408  }
409 
410  if (optimizationViews.GetSubstitutions().empty())
411  {
412  optimizationViews.AddUntouchedSubgraph(SubgraphView(subgraph));
413  }
414  else
415  {
416  ReportUntouchedLayers(optimizationViews, untouched);
417  }
418 
419  return optimizationViews;
420 }
arm_compute::Status ClAdditionValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
arm_compute::Status ClFullyConnectedWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const TensorInfo &weights, const TensorInfo &biases, const FullyConnectedDescriptor &descriptor, const ActivationDescriptor *activationDescriptor)
arm_compute::Status ClDivisionWorkloadValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
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)
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)
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
Definition: ClBackend.cpp:120
std::shared_ptr< IBackendModelContext > IBackendSpecificModelContextPtr
arm_compute::Status ClMultiplicationWorkloadValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
Status
enumeration
Definition: Types.hpp:26
arm_compute::Status ClBatchNormalizationValidate(const TensorInfo &input, const TensorInfo &output, const TensorInfo &mean, const TensorInfo &var, const TensorInfo &beta, const TensorInfo &gamma, const BatchNormalizationDescriptor &desc, const ActivationDescriptor *activationDescriptor)
arm_compute::Status ClDepthwiseConvolutionWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const DepthwiseConvolution2dDescriptor &descriptor, const TensorInfo &weights, const Optional< TensorInfo > &biases, const ActivationDescriptor *activationDescriptor)

◆ RegisterTensorHandleFactories()

void RegisterTensorHandleFactories ( TensorHandleFactoryRegistry )
overridevirtual

(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFactory::CreateTensor()/IWorkloadFactory::CreateSubtensor() methods must be implemented.

Reimplemented from IBackendInternal.

Definition at line 96 of file ClBackend.cpp.

References TensorHandleFactoryRegistry::RegisterFactory(), and TensorHandleFactoryRegistry::RegisterMemoryManager().

Referenced by ClBackend::GetId().

97 {
98  auto mgr = std::make_shared<ClMemoryManager>(std::make_unique<arm_compute::CLBufferAllocator>());
99 
100  registry.RegisterMemoryManager(mgr);
101  registry.RegisterFactory(std::make_unique<ClTensorHandleFactory>(mgr));
102 }

The documentation for this class was generated from the following files: