ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
onert::api::APIConverter Class Reference

Static Public Member Functions

static nnfw_operand convertOperand (void *alloc, const TypeInfo &type)
 
static nnfw_tensorinfo convertType (const TypeInfo &type)
 

Detailed Description

Definition at line 24 of file CustomKernel.cc.

Member Function Documentation

◆ convertOperand()

static nnfw_operand onert::api::APIConverter::convertOperand ( void *  alloc,
const TypeInfo type 
)
inlinestatic

Definition at line 27 of file CustomKernel.cc.

28 {
29 nnfw_operand api_operand;
30 api_operand.allocation = alloc;
31 api_operand.type = convertType(type);
32 return api_operand;
33 }
static nnfw_tensorinfo convertType(const TypeInfo &type)
nnfw_tensorinfo type

References nnfw_operand::allocation, convertType(), and nnfw_operand::type.

Referenced by onert::api::CustomKernel::run().

◆ convertType()

static nnfw_tensorinfo onert::api::APIConverter::convertType ( const TypeInfo type)
inlinestatic

Definition at line 35 of file CustomKernel.cc.

36 {
37 nnfw_tensorinfo api_type;
38 api_type.rank = type.shape.rank();
39 assert(type.shape.rank() <= 6);
40 std::copy(type.shape.dims().begin(), type.shape.dims().end(), std::begin(api_type.dims));
41
42 switch (type.dtype)
43 {
44 case ir::DataType::FLOAT32:
46 break;
47 case ir::DataType::INT32:
49 break;
50 case ir::DataType::QUANT_UINT8_ASYMM:
52 break;
53 case ir::DataType::BOOL8:
55 break;
56 default:
57 throw std::runtime_error("Unsupported tensor datatype");
58 }
59 return api_type;
60 }
type
Definition infer.py:18
@ NNFW_TYPE_TENSOR_BOOL
Definition nnfw.h:80
@ NNFW_TYPE_TENSOR_QUANT8_ASYMM
Definition nnfw.h:78
@ NNFW_TYPE_TENSOR_INT32
Definition onert-micro.h:79
@ NNFW_TYPE_TENSOR_FLOAT32
Definition onert-micro.h:77
tensor info describes the type and shape of tensors
NNFW_TYPE dtype
int32_t dims[NNFW_MAX_RANK]

References nnfw_tensorinfo::dims, nnfw_tensorinfo::dtype, NNFW_TYPE_TENSOR_BOOL, NNFW_TYPE_TENSOR_FLOAT32, NNFW_TYPE_TENSOR_INT32, NNFW_TYPE_TENSOR_QUANT8_ASYMM, and nnfw_tensorinfo::rank.

Referenced by convertOperand().


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