ONE - On-device Neural Engine
Loading...
Searching...
No Matches
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 26 of file CustomKernel.cc.

Member Function Documentation

◆ convertOperand()

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

Definition at line 29 of file CustomKernel.cc.

30 {
31 nnfw_operand api_operand;
32 api_operand.allocation = alloc;
33 api_operand.type = convertType(type);
34 return api_operand;
35 }
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 37 of file CustomKernel.cc.

38 {
39 nnfw_tensorinfo api_type;
40 api_type.rank = type.shape.rank();
41 assert(type.shape.rank() <= 6);
42 std::copy(type.shape.dims().begin(), type.shape.dims().end(), std::begin(api_type.dims));
43
44 switch (type.dtype)
45 {
46 case ir::DataType::FLOAT32:
48 break;
49 case ir::DataType::INT32:
51 break;
52 case ir::DataType::QUANT_UINT8_ASYMM:
54 break;
55 case ir::DataType::BOOL8:
57 break;
58 default:
59 throw std::runtime_error("Unsupported tensor datatype");
60 }
61 return api_type;
62 }
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: