ArmNN
 21.05
NeonBackendModelContext Class Reference

The NeonBackendModelContext is used to pass in Neon specific backend ModelOptions. More...

#include <NeonBackendModelContext.hpp>

Inheritance diagram for NeonBackendModelContext:
IBackendModelContext

Public Member Functions

 NeonBackendModelContext (const ModelOptions &modelOptions)
 
bool IsFastMathEnabled () const
 
unsigned int GetNumberOfThreads () const
 
- Public Member Functions inherited from IBackendModelContext
virtual ~IBackendModelContext ()
 

Detailed Description

The NeonBackendModelContext is used to pass in Neon specific backend ModelOptions.

The supported backend ModelOptions are:

  • "FastMathEnabled"
    Using the fast_math flag can lead to performance improvements in fp32 and fp16 layers but may result in
    results with reduced or different precision. The fast_math flag will not have any effect on int8 performance.
  • "NumberOfThreads"
    Specify the number of threads used by the CpuAcc backend.

Definition at line 19 of file NeonBackendModelContext.hpp.

Constructor & Destructor Documentation

◆ NeonBackendModelContext()

NeonBackendModelContext ( const ModelOptions modelOptions)

Definition at line 34 of file NeonBackendModelContext.cpp.

References armnn::ParseOptions().

35  : m_IsFastMathEnabled(false), m_NumberOfThreads(0)
36 {
37  if (!modelOptions.empty())
38  {
39  ParseOptions(modelOptions, "CpuAcc", [&](std::string name, const BackendOptions::Var& value)
40  {
41  if (name == "FastMathEnabled")
42  {
43  m_IsFastMathEnabled |= ParseBool(value, false);
44  }
45  if (name == "NumberOfThreads")
46  {
47  m_NumberOfThreads |= ParseUnsignedInt(value, 0);
48  }
49  });
50  }
51 }
void ParseOptions(const std::vector< BackendOptions > &options, BackendId backend, F f)

Member Function Documentation

◆ GetNumberOfThreads()

unsigned int GetNumberOfThreads ( ) const

Definition at line 58 of file NeonBackendModelContext.cpp.

Referenced by NeonWorkloadFactory::GetBackendId().

59 {
60  return m_NumberOfThreads;
61 }

◆ IsFastMathEnabled()

bool IsFastMathEnabled ( ) const

Definition at line 53 of file NeonBackendModelContext.cpp.

Referenced by NeonWorkloadFactory::CreateConvolution2d(), and NeonLayerSupport::IsConvolution2dSupported().

54 {
55  return m_IsFastMathEnabled;
56 }

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