ArmNN
 21.02
NeonBackend Class Reference

#include <NeonBackend.hpp>

Inheritance diagram for NeonBackend:
IBackendInternal IBackend

Public Member Functions

 NeonBackend ()=default
 
 ~NeonBackend ()=default
 
const BackendIdGetId () const override
 
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager () const override
 
IWorkloadFactoryPtr CreateWorkloadFactory (const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
 
IWorkloadFactoryPtr CreateWorkloadFactory (class TensorHandleFactoryRegistry &tensorHandleFactoryRegistry) const override
 
IWorkloadFactoryPtr CreateWorkloadFactory (const IMemoryManagerSharedPtr &memoryManager, const ModelOptions &modelOptions) const override
 
IWorkloadFactoryPtr CreateWorkloadFactory (class TensorHandleFactoryRegistry &tensorHandleFactoryRegistry, const ModelOptions &modelOptions) const override
 
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 override
 
std::vector< ITensorHandleFactory::FactoryIdGetHandleFactoryPreferences () const override
 (Optional) Returns a vector of supported TensorHandleFactory ids in preference order. More...
 
void RegisterTensorHandleFactories (class TensorHandleFactoryRegistry &registry) override
 (Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFactory::CreateTensor()/IWorkloadFactory::CreateSubtensor() methods must be implemented. More...
 
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 ModelOptions &modelOptions) 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 NeonBackend.hpp.

Constructor & Destructor Documentation

◆ NeonBackend()

NeonBackend ( )
default

◆ ~NeonBackend()

~NeonBackend ( )
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 94 of file NeonBackend.cpp.

Referenced by NeonBackend::GetId().

95 {
96  return IBackendContextPtr{};
97 }
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 99 of file NeonBackend.cpp.

Referenced by NeonBackend::GetId().

101 {
103 }
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 110 of file NeonBackend.cpp.

Referenced by NeonBackend::CreateWorkloadFactory(), NeonBackend::GetId(), and NeonBackend::GetLayerSupport().

112 {
113  return IBackendSpecificModelContextPtr{new NeonBackendModelContext{modelOptions}};
114 }
std::shared_ptr< IBackendModelContext > IBackendSpecificModelContextPtr

◆ CreateMemoryManager()

IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager ( ) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 48 of file NeonBackend.cpp.

References BaseMemoryManager::Offset.

Referenced by NeonBackend::GetId().

49 {
50  return std::make_unique<NeonMemoryManager>(std::make_unique<arm_compute::Allocator>(),
52 }

◆ CreateWorkloadFactory() [1/4]

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

Implements IBackendInternal.

Definition at line 54 of file NeonBackend.cpp.

Referenced by NeonBackend::GetId().

56 {
57  return std::make_unique<NeonWorkloadFactory>(
58  PolymorphicPointerDowncast<NeonMemoryManager>(memoryManager));
59 }

◆ CreateWorkloadFactory() [2/4]

IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory ( class TensorHandleFactoryRegistry tensorHandleFactoryRegistry) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 68 of file NeonBackend.cpp.

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

70 {
71  auto memoryManager = std::make_shared<NeonMemoryManager>(std::make_unique<arm_compute::Allocator>(),
73 
74  tensorHandleFactoryRegistry.RegisterMemoryManager(memoryManager);
75  tensorHandleFactoryRegistry.RegisterFactory(std::make_unique<NeonTensorHandleFactory>(memoryManager));
76 
77  return std::make_unique<NeonWorkloadFactory>(
78  PolymorphicPointerDowncast<NeonMemoryManager>(memoryManager));
79 }

◆ CreateWorkloadFactory() [3/4]

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

Reimplemented from IBackendInternal.

Definition at line 61 of file NeonBackend.cpp.

References NeonBackend::CreateBackendSpecificModelContext().

63 {
64  return std::make_unique<NeonWorkloadFactory>(
65  PolymorphicPointerDowncast<NeonMemoryManager>(memoryManager), CreateBackendSpecificModelContext(modelOptions));
66 }
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override

◆ CreateWorkloadFactory() [4/4]

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

Reimplemented from IBackendInternal.

Definition at line 81 of file NeonBackend.cpp.

References NeonBackend::CreateBackendSpecificModelContext(), BaseMemoryManager::Offset, TensorHandleFactoryRegistry::RegisterFactory(), and TensorHandleFactoryRegistry::RegisterMemoryManager().

83 {
84  auto memoryManager = std::make_shared<NeonMemoryManager>(std::make_unique<arm_compute::Allocator>(),
86 
87  tensorHandleFactoryRegistry.RegisterMemoryManager(memoryManager);
88  tensorHandleFactoryRegistry.RegisterFactory(std::make_unique<NeonTensorHandleFactory>(memoryManager));
89 
90  return std::make_unique<NeonWorkloadFactory>(
91  PolymorphicPointerDowncast<NeonMemoryManager>(memoryManager), CreateBackendSpecificModelContext(modelOptions));
92 }
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override

◆ 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 400 of file NeonBackend.cpp.

References NeonTensorHandleFactory::GetIdStatic().

Referenced by NeonBackend::GetId().

401 {
402  return std::vector<ITensorHandleFactory::FactoryId>() = { NeonTensorHandleFactory::GetIdStatic() };
403 }
static const FactoryId & GetIdStatic()

◆ GetId()

◆ GetIdStatic()

const BackendId & GetIdStatic ( )
static

Definition at line 42 of file NeonBackend.cpp.

References armnn::NeonBackendId().

Referenced by NeonBackend::GetId().

43 {
44  static const BackendId s_Id{NeonBackendId()};
45  return s_Id;
46 }
constexpr const char * NeonBackendId()

◆ GetLayerSupport() [1/2]

IBackendInternal::ILayerSupportSharedPtr GetLayerSupport ( ) const
overridevirtual

Implements IBackendInternal.

Definition at line 116 of file NeonBackend.cpp.

Referenced by NeonBackend::GetId().

117 {
118  static ILayerSupportSharedPtr layerSupport
119  {
121  };
122  return layerSupport;
123 }
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 125 of file NeonBackend.cpp.

References NeonBackend::CreateBackendSpecificModelContext().

126 {
127  static ILayerSupportSharedPtr layerSupport
128  {
129  new NeonLayerSupport(CreateBackendSpecificModelContext(modelOptions))
130  };
131  return layerSupport;
132 }
IBackendInternal::IBackendSpecificModelContextPtr CreateBackendSpecificModelContext(const ModelOptions &modelOptions) const override
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr

◆ GetOptimizations()

IBackendInternal::Optimizations GetOptimizations ( ) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 105 of file NeonBackend.cpp.

Referenced by NeonBackend::GetId().

106 {
107  return Optimizations{};
108 }
std::vector< OptimizationPtr > Optimizations

◆ OptimizeSubgraphView()

OptimizationViews OptimizeSubgraphView ( const SubgraphView subgraph) const
overridevirtual

Reimplemented from IBackendInternal.

Definition at line 134 of file NeonBackend.cpp.

References armnn::Activation, armnn::Addition, OptimizationViews::AddUntouchedSubgraph(), armnn::BatchNormalization, SubgraphView::begin(), Layer::BeginOutputSlots(), armnn::Convolution2d, 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(), 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, DepthwiseConvolution2dLayer::m_Weight, FullyConnectedLayer::m_Weight, Convolution2dLayer::m_Weight, armnn::Multiplication, armnn::NeonAdditionWorkloadValidate(), armnn::NeonBatchNormalizationValidate(), armnn::NeonConvolution2dWorkloadValidate(), armnn::NeonDepthwiseConvolutionWorkloadValidate(), armnn::NeonDivisionWorkloadValidate(), armnn::NeonFullyConnectedWorkloadValidate(), armnn::NeonMultiplicationWorkloadValidate(), armnn::NeonSubtractionWorkloadValidate(), armnn::ReportUntouchedLayers(), and armnn::Subtraction.

Referenced by NeonBackend::GetId().

135 {
136  OptimizationViews optimizationViews;
137 
138  auto it = subgraph.end();
139  std::map<LayerGuid, Layer*> untouched;
140 
141  while (it != subgraph.begin())
142  {
143  --it;
144  Layer& base = **it;
145  untouched.insert({base.GetGuid(), &base});
146  }
147 
148  it = subgraph.end();
149  while (it != subgraph.begin())
150  {
151  --it;
152  Layer& base = **it;
153 
154  if ((base.GetType() == LayerType::DepthwiseConvolution2d || base.GetType() == LayerType::Convolution2d
155  || base.GetType() == LayerType::BatchNormalization || base.GetType() == LayerType::FullyConnected
156  || base.GetType() == LayerType::Addition || base.GetType() == LayerType::Multiplication
157  || base.GetType() == LayerType::Subtraction || base.GetType() == LayerType::Division)
158  && (base.GetAdditionalInformation<ActivationDescriptor>() == nullptr))
159  {
160  for (auto output = base.BeginOutputSlots(); output != base.EndOutputSlots(); ++output)
161  {
162  if (output->GetNumConnections() == 1)
163  {
164  for (auto&& childInput : output->GetConnections())
165  {
166  if ((childInput->GetOwningLayer().GetType() == LayerType::Activation) &&
167  (checkDataTypeInputandOutput(childInput->GetOwningLayer())))
168  {
169  Layer& child = childInput->GetOwningLayer();
170 
171  auto* activationLayer = PolymorphicDowncast<ActivationLayer*>(&child);
172 
173  const std::string name = std::string("fused-") + child.GetName() + std::string("-into-") +
174  base.GetName();
175 
176  // Get params from activation layer
177  ActivationDescriptor activationDesc = activationLayer->GetParameters();
178 
179  if (base.GetType() == LayerType::Convolution2d)
180  {
181  Convolution2dLayer* baseLayer = PolymorphicDowncast<Convolution2dLayer*>(&base);
182 
183  Optional<TensorInfo> biases;
184 
185  if (baseLayer->GetParameters().m_BiasEnabled)
186  {
187  biases = baseLayer->m_Bias->GetTensorInfo();
188  }
189 
191  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
192  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
193  baseLayer->GetParameters(),
194  baseLayer->m_Weight->GetTensorInfo(),
195  biases,
196  false,
197  &activationDesc);
198 
199  if (status)
200  {
201  FuseLayerWithWeightsAndBiases<Convolution2dLayer>(optimizationViews,
202  baseLayer,
203  activationLayer,
204  activationDesc,
205  name);
206  untouched.erase(baseLayer->GetGuid());
207  untouched.erase(activationLayer->GetGuid());
208  }
209  }
210  else if (base.GetType() == LayerType::DepthwiseConvolution2d)
211  {
212  DepthwiseConvolution2dLayer* baseLayer =
213  PolymorphicDowncast<DepthwiseConvolution2dLayer*>(&base);
214 
215  Optional<TensorInfo> biases;
216 
217  if (baseLayer->GetParameters().m_BiasEnabled)
218  {
219  biases = baseLayer->m_Bias->GetTensorInfo();
220  }
221 
223  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
224  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
225  baseLayer->GetParameters(),
226  baseLayer->m_Weight->GetTensorInfo(),
227  biases,
228  &activationDesc);
229 
230  if (status)
231  {
232  FuseLayerWithWeightsAndBiases<DepthwiseConvolution2dLayer>(optimizationViews,
233  baseLayer,
234  activationLayer,
235  activationDesc,
236  name);
237  untouched.erase(baseLayer->GetGuid());
238  untouched.erase(activationLayer->GetGuid());
239  }
240  }
241  else if (base.GetType() == LayerType::FullyConnected)
242  {
243  FullyConnectedLayer* baseLayer = PolymorphicDowncast<FullyConnectedLayer*>(&base);
244 
246  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
247  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
248  baseLayer->m_Weight->GetTensorInfo(),
249  baseLayer->m_Bias->GetTensorInfo(),
250  baseLayer->GetParameters(),
251  &activationDesc);
252 
253  if (status)
254  {
255  FuseLayerWithWeightsAndBiases<FullyConnectedLayer>(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::BatchNormalization)
265  {
266  BatchNormalizationLayer* baseLayer =
267  PolymorphicDowncast<BatchNormalizationLayer*>(&base);
268 
270  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
271  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
272  baseLayer->m_Mean->GetTensorInfo(),
273  baseLayer->m_Variance->GetTensorInfo(),
274  baseLayer->m_Beta->GetTensorInfo(),
275  baseLayer->m_Gamma->GetTensorInfo(),
276  baseLayer->GetParameters(),
277  &activationDesc);
278 
279  if (status)
280  {
281  BatchNormalizationLayer* replacementLayer =
282  FuseLayerWithParameters<BatchNormalizationLayer>(
283  optimizationViews,
284  baseLayer,
285  activationLayer,
286  activationDesc,
287  name);
288 
289  replacementLayer->m_Beta = std::move(baseLayer->m_Beta);
290  replacementLayer->m_Gamma = std::move(baseLayer->m_Gamma);
291  replacementLayer->m_Mean = std::move(baseLayer->m_Mean);
292  replacementLayer->m_Variance = std::move(baseLayer->m_Variance);
293  untouched.erase(baseLayer->GetGuid());
294  untouched.erase(activationLayer->GetGuid());
295  }
296  }
297  else if (base.GetType() == LayerType::Addition)
298  {
299  AdditionLayer* baseLayer = PolymorphicDowncast<AdditionLayer*>(&base);
300 
302  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
303  baseLayer->GetInputSlot(1).GetConnectedOutputSlot()->GetTensorInfo(),
304  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
305  &activationDesc);
306 
307  if (status)
308  {
309  FuseLayerWithoutParameters<AdditionLayer>(optimizationViews,
310  baseLayer,
311  activationLayer,
312  activationDesc,
313  name);
314  untouched.erase(baseLayer->GetGuid());
315  untouched.erase(activationLayer->GetGuid());
316  }
317  }
318  else if (base.GetType() == LayerType::Division)
319  {
320  DivisionLayer* baseLayer = PolymorphicDowncast<DivisionLayer*>(&base);
321 
323  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
324  baseLayer->GetInputSlot(1).GetConnectedOutputSlot()->GetTensorInfo(),
325  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
326  &activationDesc);
327 
328  if (status)
329  {
330  FuseLayerWithoutParameters<DivisionLayer>(optimizationViews,
331  baseLayer,
332  activationLayer,
333  activationDesc,
334  name);
335  untouched.erase(baseLayer->GetGuid());
336  untouched.erase(activationLayer->GetGuid());
337  }
338  }
339  else if (base.GetType() == LayerType::Multiplication)
340  {
341  MultiplicationLayer* baseLayer = PolymorphicDowncast<MultiplicationLayer*>(&base);
342 
344  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
345  baseLayer->GetInputSlot(1).GetConnectedOutputSlot()->GetTensorInfo(),
346  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
347  &activationDesc);
348 
349  if (status)
350  {
351  FuseLayerWithoutParameters<MultiplicationLayer>(optimizationViews,
352  baseLayer,
353  activationLayer,
354  activationDesc,
355  name);
356  untouched.erase(baseLayer->GetGuid());
357  untouched.erase(activationLayer->GetGuid());
358  }
359  }
360  else if (base.GetType() == LayerType::Subtraction)
361  {
362  SubtractionLayer* baseLayer = PolymorphicDowncast<SubtractionLayer*>(&base);
363 
365  baseLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
366  baseLayer->GetInputSlot(1).GetConnectedOutputSlot()->GetTensorInfo(),
367  activationLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo(),
368  &activationDesc);
369 
370  if (status)
371  {
372  FuseLayerWithoutParameters<SubtractionLayer>(optimizationViews,
373  baseLayer,
374  activationLayer,
375  activationDesc,
376  name);
377  untouched.erase(baseLayer->GetGuid());
378  untouched.erase(activationLayer->GetGuid());
379  }
380  }
381  }
382  }
383  }
384  }
385  }
386  }
387 
388  if (optimizationViews.GetSubstitutions().empty())
389  {
390  optimizationViews.AddUntouchedSubgraph(SubgraphView(subgraph));
391  }
392  else
393  {
394  ReportUntouchedLayers(optimizationViews, untouched);
395  }
396 
397  return optimizationViews;
398 }
arm_compute::Status NeonBatchNormalizationValidate(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 ReportUntouchedLayers(OptimizationViews &optimizationViews, std::map< LayerGuid, Layer *> untouched)
arm_compute::Status NeonDepthwiseConvolutionWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const DepthwiseConvolution2dDescriptor &descriptor, const TensorInfo &weights, const Optional< TensorInfo > &biases, const ActivationDescriptor *activationDescriptor)
arm_compute::Status NeonFullyConnectedWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const TensorInfo &weights, const TensorInfo &biases, const FullyConnectedDescriptor &descriptor, const ActivationDescriptor *activationDescriptor)
arm_compute::Status NeonAdditionWorkloadValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
arm_compute::Status NeonSubtractionWorkloadValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
Status
enumeration
Definition: Types.hpp:26
arm_compute::Status NeonConvolution2dWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const Convolution2dDescriptor &descriptor, const TensorInfo &weights, const Optional< TensorInfo > &biases, bool isFastMathEnabled, const ActivationDescriptor *activationDescriptor)
arm_compute::Status NeonDivisionWorkloadValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)
arm_compute::Status NeonMultiplicationWorkloadValidate(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, const ActivationDescriptor *activationDescriptor)

◆ RegisterTensorHandleFactories()

void RegisterTensorHandleFactories ( class 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 405 of file NeonBackend.cpp.

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

Referenced by NeonBackend::GetId().

406 {
407  auto memoryManager = std::make_shared<NeonMemoryManager>(std::make_unique<arm_compute::Allocator>(),
409 
410  registry.RegisterMemoryManager(memoryManager);
411  registry.RegisterFactory(std::make_unique<NeonTensorHandleFactory>(memoryManager));
412 }

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