ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert_micro::core Namespace Reference

Namespaces

namespace  memory
 
namespace  reader
 
namespace  train
 
namespace  utils
 

Data Structures

struct  ArithmeticQuantParams
 
struct  BinaryArithmeticBroadcastParams
 
struct  ComparisonParams
 
struct  ConcatenationParams
 
struct  ConvQuant
 
struct  FloatConv2D
 
struct  FullyConnectedParams
 
struct  L2NormalizationParams
 
struct  LogSoftmaxParams
 
struct  OMDataTypeImpl
 C++ scalar type corresponding to each OMDataType. More...
 
struct  OMDataTypeImpl< OMDataType::BOOL >
 
struct  OMDataTypeImpl< OMDataType::FLOAT16 >
 
struct  OMDataTypeImpl< OMDataType::FLOAT32 >
 
struct  OMDataTypeImpl< OMDataType::FLOAT64 >
 
struct  OMDataTypeImpl< OMDataType::S16 >
 
struct  OMDataTypeImpl< OMDataType::S32 >
 
struct  OMDataTypeImpl< OMDataType::S64 >
 
struct  OMDataTypeImpl< OMDataType::S8 >
 
struct  OMDataTypeImpl< OMDataType::U16 >
 
struct  OMDataTypeImpl< OMDataType::U32 >
 
struct  OMDataTypeImpl< OMDataType::U64 >
 
struct  OMDataTypeImpl< OMDataType::U8 >
 
class  OMRuntimeContext
 
class  OMRuntimeGraph
 
class  OMRuntimeModule
 
class  OMRuntimeShape
 
class  OMRuntimeStorage
 
class  OMTrainingRuntimeModule
 
struct  PadParams
 
struct  Pool2DParams
 
struct  QuantizationParams
 
struct  SliceParams
 
struct  SoftmaxParams
 
struct  SplitParams
 
struct  StridedSliceParams
 
struct  SVDFQuantParams
 
struct  TransposeParams
 

Enumerations

enum class  OMDataType {
  Unknown , U8 , U16 , U32 ,
  U64 , S8 , S16 , S32 ,
  S64 , FLOAT16 , FLOAT32 , FLOAT64 ,
  BOOL
}
 "scalar" value type More...
 
enum class  BroadcastableOpCategory : uint8_t {
  kNone , kNonBroadcast , kFirstInputBroadcastsFast , kSecondInputBroadcastsFast ,
  kGenericBroadcast , kScalarFirstBroadcast , kScalarSecondBroadcast
}
 
enum  OpTrainableRankType { ALL = 0 , ONLY_BIAS = 1 , UP_1_2_PART = 2 , LOWER_1_2_PART = 3 }
 
enum  OMKernelType { Normal , Inplace }
 
enum  OMBuilderCustomID { CUSTOM_custom_gru }
 
enum class  OMBuilderID { BuiltinOperatorsSize , Size }
 

Functions

OMDataType onertMicroDatatype (const circle::TensorType type)
 
uint32_t size (OMDataType data_type)
 Returns the size of the data type.
 
size_t getOMDataTypeSize (OMDataType data_type)
 
OMStatus getBuiltinOperatorBuilderId (const circle::BuiltinOperator &opcode, core::OMBuilderID &builderID)
 
OMStatus getCustomOperatorBuilderId (const flatbuffers::String *custom_opcode, core::OMBuilderID &builderID)
 
OMStatus getCustomOperatorByBuilderId (core::OMBuilderID &builderID, OMBuilderCustomID &opcode)
 
OMStatus getBuilderId (const circle::OperatorCode *opcode, core::OMBuilderID &builderID)
 

Enumeration Type Documentation

◆ BroadcastableOpCategory

enum class onert_micro::core::BroadcastableOpCategory : uint8_t
strong
Enumerator
kNone 
kNonBroadcast 
kFirstInputBroadcastsFast 
kSecondInputBroadcastsFast 
kGenericBroadcast 
kScalarFirstBroadcast 
kScalarSecondBroadcast 

Definition at line 28 of file OMKernelData.h.

29{
30 kNone,
31 kNonBroadcast, // Matching input shapes.
32 kFirstInputBroadcastsFast, // Fivefold nested loops.
33 kSecondInputBroadcastsFast, // Fivefold nested loops.
34 kGenericBroadcast, // Fall-back.
35 kScalarFirstBroadcast, // Scalar
36 kScalarSecondBroadcast, // Scalar
37};

◆ OMBuilderCustomID

Enumerator
CUSTOM_custom_gru 

Definition at line 44 of file OMKernelType.h.

◆ OMBuilderID

enum class onert_micro::core::OMBuilderID
strong
Enumerator
BuiltinOperatorsSize 
Size 

Definition at line 51 of file OMKernelType.h.

52{
53#include "KernelsToBuild.lst"
54 BuiltinOperatorsSize, // casts to count of values in BuilderId enum
55#include "CustomKernelsToBuild.lst"
56 Size
57};

◆ OMDataType

enum class onert_micro::core::OMDataType
strong

"scalar" value type

Enumerator
Unknown 
U8 
U16 
U32 
U64 
S8 
S16 
S32 
S64 
FLOAT16 
FLOAT32 
FLOAT64 
BOOL 

Definition at line 34 of file OMDataType.h.

35{
36 Unknown, // Unknown type (serves as a default value)
37
38 U8, // 8-bit unsigned integer
39 U16, // 16-bit unsigned integer
40 U32, // 32-bit unsigned integer
41 U64, // 64-bit unsigned integer
42
43 S8, // 8-bit signed integer
44 S16, // 16-bit signed integer
45 S32, // 32-bit signed integer
46 S64, // 64-bit signed integer
47
48 FLOAT16, // IEEE 16-bit floating-point
49 FLOAT32, // IEEE 32-bit floating-point
50 FLOAT64, // IEEE 64-bit floating-point
51
52 BOOL, // Boolean
53};

◆ OMKernelType

Enumerator
Normal 
Inplace 

Definition at line 38 of file OMKernelType.h.

◆ OpTrainableRankType

Enumerator
ALL 
ONLY_BIAS 
UP_1_2_PART 
LOWER_1_2_PART 

Definition at line 29 of file OMKernelType.h.

30{
31 ALL = 0, // 0 - Train all weights in the operation
32 ONLY_BIAS = 1, // 1 - Train bias only in the operation
33 UP_1_2_PART = 2, // 2 - Train the upper 1/2 part of the operation
34 LOWER_1_2_PART = 3, // 3 - Train the lower 1/2 part of the operation
35 // TODO add more
36};

Function Documentation

◆ getBuilderId()

OMStatus onert_micro::core::getBuilderId ( const circle::OperatorCode *  opcode,
core::OMBuilderID builderID 
)

Definition at line 58 of file OMKernelType.cpp.

60{
61 OMStatus status;
62
63 if (opcode->builtin_code() == circle::BuiltinOperator_CUSTOM)
64 status = core::getCustomOperatorBuilderId(opcode->custom_code(), builderID);
65 else
66 status = core::getBuiltinOperatorBuilderId(opcode->builtin_code(), builderID);
67
68 assert(status == Ok && "Unknown operation");
69 if (status == UnsupportedOp or builderID == core::OMBuilderID::Size)
70 return UnsupportedOp;
71
72 return status;
73}
OMStatus getCustomOperatorBuilderId(const flatbuffers::String *custom_opcode, core::OMBuilderID &builderID)
OMStatus getBuiltinOperatorBuilderId(const circle::BuiltinOperator &opcode, core::OMBuilderID &builderID)
@ UnsupportedOp
Definition OMStatus.h:29

References getBuiltinOperatorBuilderId(), getCustomOperatorBuilderId(), onert_micro::Ok, and onert_micro::UnsupportedOp.

Referenced by onert_micro::import::OMKernelConfiguration::configureKernels(), onert_micro::train::OMBackpropExecute::runBackward(), and onert_micro::execute::OMKernelExecute::runForward().

◆ getBuiltinOperatorBuilderId()

OMStatus onert_micro::core::getBuiltinOperatorBuilderId ( const circle::BuiltinOperator &  opcode,
core::OMBuilderID builderID 
)

Definition at line 22 of file OMKernelType.cpp.

24{
25 switch (opcode)
26 {
27#define REGISTER_KERNEL(builtin_operator, name) \
28 case circle::BuiltinOperator_##builtin_operator: \
29 builderID = core::OMBuilderID::BuiltinOperator_##builtin_operator; \
30 break;
31#include "KernelsToBuild.lst"
32#undef REGISTER_KERNEL
33 default:
34 assert(false && "Unsupported operation");
35 return UnsupportedOp;
36 }
37 return Ok;
38}

References onert_micro::Ok, and onert_micro::UnsupportedOp.

Referenced by getBuilderId().

◆ getCustomOperatorBuilderId()

OMStatus onert_micro::core::getCustomOperatorBuilderId ( const flatbuffers::String custom_opcode,
core::OMBuilderID builderID 
)

Definition at line 75 of file OMKernelType.cpp.

77{
78#define REGISTER_CUSTOM_KERNEL(name, string_name) \
79 const char arr[] = string_name; \
80 if (std::strcmp(custom_opcode->c_str(), arr) == 0) \
81 { \
82 builderID = core::OMBuilderID::CUSTOM_##name; \
83 return Ok; \
84 }
85#include "CustomKernelsToBuild.lst"
86#undef REGISTER_CUSTOM_KERNEL
87 assert(false && "Unsupported custom operation");
88 return UnsupportedOp;
89}

References onert_micro::UnsupportedOp.

Referenced by getBuilderId().

◆ getCustomOperatorByBuilderId()

OMStatus onert_micro::core::getCustomOperatorByBuilderId ( core::OMBuilderID builderID,
OMBuilderCustomID opcode 
)

Definition at line 40 of file OMKernelType.cpp.

42{
43 switch (builderID)
44 {
45#define REGISTER_CUSTOM_KERNEL(name, string_name) \
46 case core::OMBuilderID::CUSTOM_##name: \
47 opcode = core::OMBuilderCustomID::CUSTOM_##name; \
48 break;
49#include "CustomKernelsToBuild.lst"
50#undef REGISTER_CUSTOM_KERNEL
51 default:
52 assert(false && "Unsupported operation");
53 return UnsupportedOp;
54 }
55 return Ok;
56}

References onert_micro::Ok, and onert_micro::UnsupportedOp.

◆ getOMDataTypeSize()

size_t onert_micro::core::getOMDataTypeSize ( OMDataType  data_type)
inline

Definition at line 179 of file OMDataType.h.

179{ return size(data_type); }
int32_t size[5]
Definition Slice.cpp:35

References size.

Referenced by onert_micro::core::memory::OMRuntimeAllocator::allocate(), and onert_micro::core::memory::OMRuntimeAllocator::allocateGraphInputs().

◆ onertMicroDatatype()

onert_micro::core::OMDataType onert_micro::core::onertMicroDatatype ( const circle::TensorType  type)

Definition at line 19 of file OMDataType.cpp.

20{
21 switch (type)
22 {
23 case circle::TensorType_FLOAT32:
24 return OMDataType::FLOAT32;
25 case circle::TensorType_FLOAT16:
26 return OMDataType::FLOAT16;
27 case circle::TensorType_INT32:
28 return OMDataType::S32;
29 case circle::TensorType_UINT8:
30 return OMDataType::U8;
31 case circle::TensorType_INT64:
32 return OMDataType::S64;
33 case circle::TensorType_BOOL:
34 return OMDataType::BOOL;
35 case circle::TensorType_INT16:
36 return OMDataType::S16;
37 case circle::TensorType_COMPLEX64:
38 break;
39 case circle::TensorType_INT8:
40 return OMDataType::S8;
41 default:
42 break;
43 }
44 assert(false);
45 return OMDataType::Unknown;
46}

Referenced by onert_micro::core::memory::OMRuntimeAllocator::allocate(), onert_micro::core::memory::OMRuntimeAllocator::allocateGraphInputs(), and onert_micro::execute::execute_reshape_common().

◆ size()

uint32_t onert_micro::core::size ( OMDataType  data_type)
inline

Returns the size of the data type.

Note
If you need the size at compile time, use sizeof(typename OMDataTypeImpl<DT>::Type).

Definition at line 144 of file OMDataType.h.

145{
146 switch (data_type)
147 {
148 case OMDataType::S8:
150 case OMDataType::U8:
152 case OMDataType::S16:
154 case OMDataType::U16:
156 case OMDataType::S32:
158 case OMDataType::U32:
160 case OMDataType::S64:
162 case OMDataType::U64:
164 case OMDataType::FLOAT16:
166 case OMDataType::FLOAT32:
168 case OMDataType::FLOAT64:
170 case OMDataType::BOOL:
172 default:
173 // TODO Support remaining data types.
174 assert(false);
175 return 1; // Avoid compiler warning.
176 }
177}
C++ scalar type corresponding to each OMDataType.
Definition OMDataType.h:61

References BOOL, FLOAT16, FLOAT32, FLOAT64, S16, S32, S64, S8, U16, U32, U64, and U8.