ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::util Namespace Reference

Namespaces

namespace  config
 
namespace  logging
 

Data Structures

class  CPUTimer
 
class  Index
 A wrapper class for unsigned integral Index NOTE : Max value of the underlying type is used as the invalid value. More...
 
class  ITimer
 
class  MinMaxMap
 
class  ObjectManager
 Class that owns objects and maps them with indices as a handle for them. More...
 
class  Set
 Class for set of custom element &. More...
 
class  TracingCtx
 Class to maintain information about profiling per session. More...
 

Typedefs

using CfgKeyValues = std::unordered_map< std::string, std::string >
 

Functions

template<typename T >
void CalculateActivationRange (ir::Activation activation, T *activation_min, T *activation_max)
 
void setConfigKeyValues (const CfgKeyValues &keyValues)
 
bool toBool (const std::string &val)
 
int toInt (const std::string &val)
 
bool getConfigBool (const std::string &key)
 
int getConfigInt (const std::string &key)
 
std::string getConfigString (const std::string &key)
 
void config_source (std::unique_ptr< IConfigSource > &&source)
 
void config_source_ext (std::unique_ptr< IConfigSource > &&source)
 

Typedef Documentation

◆ CfgKeyValues

using onert::util::CfgKeyValues = typedef std::unordered_map<std::string, std::string>

Definition at line 28 of file ConfigSource.h.

Function Documentation

◆ CalculateActivationRange()

template<typename T >
void onert::util::CalculateActivationRange ( ir::Activation  activation,
T *  activation_min,
T *  activation_max 
)

Definition at line 30 of file CalculateActivationRange.h.

31{
32 if (activation == ir::Activation::RELU)
33 {
34 *activation_min = 0;
35 *activation_max = std::numeric_limits<T>::max();
36 }
37 else if (activation == ir::Activation::RELU6)
38 {
39 *activation_min = 0;
40 *activation_max = 6;
41 }
42 else if (activation == ir::Activation::RELU1)
43 {
44 *activation_min = -1;
45 *activation_max = 1;
46 }
47 else if (activation == ir::Activation::SIGMOID)
48 {
49 *activation_min = 0;
50 *activation_max = 1;
51 }
52 else if (activation == ir::Activation::NONE)
53 {
54 *activation_min = std::numeric_limits<T>::lowest();
55 *activation_max = std::numeric_limits<T>::max();
56 }
57 else
58 {
59 throw std::runtime_error{"Unsupported fused activation function."};
60 }
61}

References onert::ir::NONE, onert::ir::RELU, onert::ir::RELU1, onert::ir::RELU6, and onert::ir::SIGMOID.

Referenced by onert::backend::train::ops::BackPropAccumulator::BackPropAccumulator(), onert::backend::cpu::ops::DepthwiseConvolutionLayer::convFloat32(), onert::backend::ruy::ops::ConvolutionLayer::convFloat32(), onert::backend::cpu::ops::DepthwiseConvolutionLayer::convQ8iHybridPerChannel(), onert::backend::cpu::ops::FullyConnectedLayer::fullyConnected16x1Float32(), onert::backend::cpu::ops::FullyConnectedLayer::fullyConnectedFloat32(), onert::backend::ruy::ops::FullyConnectedLayer::fullyConnectedFloat32(), and onert::backend::cpu::ops::PowLayer::powFloat32().

◆ config_source()

void onert::util::config_source ( std::unique_ptr< IConfigSource > &&  source)

Definition at line 39 of file ConfigSource.cc.

39{ _source = std::move(source); }

References config_source().

Referenced by config_source().

◆ config_source_ext()

void onert::util::config_source_ext ( std::unique_ptr< IConfigSource > &&  source)

Definition at line 40 of file ConfigSource.cc.

40{ _source_ext = std::move(source); }

Referenced by setConfigKeyValues().

◆ getConfigBool()

bool onert::util::getConfigBool ( const std::string &  key)

Definition at line 118 of file ConfigSource.cc.

119{
120 auto raw = getConfigOrDefault(key);
121 return toBool(raw);
122}
bool toBool(const std::string &val)

References toBool().

Referenced by onert::loader::BaseLoader< LoaderDomain >::BaseLoader(), onert::compiler::CompilerOptions::fromGlobalConfig(), and onert::exec::ExecutionOptions::fromGlobalConfig().

◆ getConfigInt()

int onert::util::getConfigInt ( const std::string &  key)

◆ getConfigString()

std::string onert::util::getConfigString ( const std::string &  key)

◆ setConfigKeyValues()

void onert::util::setConfigKeyValues ( const CfgKeyValues keyValues)

Definition at line 42 of file ConfigSource.cc.

43{
44 auto configsrc = std::make_unique<GeneralConfigSource>();
45
46 for (const auto &[key, val] : keyValues)
47 {
48 VERBOSE(NNPKG_CONFIGS) << "(" << key << ") = (" << val << ")" << std::endl;
49 configsrc->set(key, val);
50 }
51
52 onert::util::config_source_ext(std::move(configsrc));
53}
#define VERBOSE(name, lv)
Definition Log.h:71
void config_source_ext(std::unique_ptr< IConfigSource > &&source)

References config_source_ext(), and VERBOSE.

Referenced by nnfw_session::load_model_from_path().

◆ toBool()

bool onert::util::toBool ( const std::string &  val)

Definition at line 109 of file ConfigSource.cc.

110{
111 static const std::array<std::string, 5> false_list{"0", "OFF", "FALSE", "N", "NO"};
112 auto false_found = std::find(false_list.begin(), false_list.end(), val);
113 return false_found == false_list.end();
114}

Referenced by getConfigBool().

◆ toInt()

int onert::util::toInt ( const std::string &  val)

Definition at line 116 of file ConfigSource.cc.

116{ return std::stoi(val); }

Referenced by getConfigInt().