ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::misc Namespace Reference

Namespaces

namespace  fp32
 
namespace  tensor
 

Data Structures

class  EnvConfigSource
 
class  EnvVar
 Class to access environment variable. More...
 
class  GeneralConfigSource
 
struct  IConfigSource
 

Functions

template<typename DstType , typename SrcType >
DstType polymorphic_downcast (SrcType *x)
 
template<typename DstType , typename SrcType >
DstType polymorphic_downcast (SrcType &x)
 
std::vector< std::string > split (const std::string &s, char delim)
 
template<typename... Args>
std::string str (Args &&...args)
 
template<typename InputIt >
std::string join (InputIt first, InputIt last, const std::string &concat)
 
template<typename E >
constexpr auto to_underlying (E e) noexcept
 

Function Documentation

◆ join()

template<typename InputIt >
std::string nnfw::misc::join ( InputIt  first,
InputIt  last,
const std::string &  concat 
)

Definition at line 65 of file string_helpers.h.

66{
67 std::string ret;
68 if (first == last)
69 return ret;
70
71 ret += *first;
72 for (++first; first != last; ++first)
73 {
74 ret += concat;
75 ret += *first;
76 }
77 return ret;
78}

Referenced by onert::api::Session::get_config(), and onert::compiler::CompilerOptions::verboseOptions().

◆ polymorphic_downcast() [1/2]

template<typename DstType , typename SrcType >
DstType nnfw::misc::polymorphic_downcast ( SrcType &  x)
inline

Definition at line 34 of file polymorphic_downcast.h.

35{
36 assert(std::addressof(dynamic_cast<DstType>(x)) == std::addressof(x));
37 return static_cast<DstType>(x);
38}

◆ polymorphic_downcast() [2/2]

template<typename DstType , typename SrcType >
DstType nnfw::misc::polymorphic_downcast ( SrcType *  x)
inline

Definition at line 28 of file polymorphic_downcast.h.

29{
30 assert(dynamic_cast<DstType>(x) == x);
31 return static_cast<DstType>(x);
32}

◆ split()

std::vector< std::string > nnfw::misc::split ( const std::string &  s,
char  delim 
)
inline

Definition at line 46 of file string_helpers.h.

47{
48 std::stringstream ss(s);
49 std::string item;
50 std::vector<std::string> elems;
51 while (std::getline(ss, item, delim))
52 {
53 elems.push_back(item);
54 }
55 return elems;
56}

Referenced by onert::compiler::CompilerOptions::fromGlobalConfig(), onert::api::Session::load_model_from_path(), onert::api::Session::set_available_backends(), and onert::compiler::ManualSchedulerOptions::setBackendMap().

◆ str()

template<typename... Args>
std::string nnfw::misc::str ( Args &&...  args)

Definition at line 58 of file string_helpers.h.

59{
60 std::stringstream ss;
61 _str(ss, std::forward<Args>(args)...);
62 return ss.str();
63}

Referenced by onert::compiler::Compiler::compile(), onert::compiler::train::TrainingCompiler::compile(), and nnfw::misc::tensor::Shape::from().

◆ to_underlying()

template<typename E >
constexpr auto nnfw::misc::to_underlying ( e)
constexprnoexcept

Definition at line 27 of file to_underlying.h.

28{
29 return static_cast<std::underlying_type_t<E>>(e);
30}