Overview

Introduction

An AI CPU operator is an operation of complete compute logic that runs on AI CPU, one of the compute engines in Ascend AI Processor. During neural network (NN) training or inference, if you find an unsupported operator when converting a third-party open-source network to adapt to Ascend AI Processor, a custom AI CPU operator can help you streamline the model execution process and improve the functionality debugging efficiency.

AI CPU provides a range of APIs for you to develop AI CPU operators. For details about the header files, see API Overview.

API Overview

Table 1 API Overview

API

Description

Header File

Library File

Class CpuKernelContext

Describes the context definition and methods of CPU kernels, which can be used to obtain information such as inputs, outputs, and attributes.

include/aicpu/cpu_context.h under the CANN component directory

opp/built-in/op_impl/aicpu/aicpu_kernel/lib/libcpu_kernels_context.a under the CANN component directory

Class TensorShape

Describes the tensor shape definitions and methods of CPU kernels.

include/aicpu/cpu_tensor_shape.h under the CANN component directory

Class Tensor

Describes the tensor definitions and methods of the CPU kernels.

include/aicpu/cpu_tensor.h under the CANN component directory

Class AttrValue

Describes the attribute definition and method of CPU kernels.

include/aicpu/cpu_attr_value.h under the CANN component directory

Data types

Describes the data types and formats of CPU kernels.

include/aicpu/cpu_types.h under the CANN component directory

Macro definition

Describes the kernel base class definition and registration macros of CPU kernels.

include/aicpu/cpu_kernel.h under the CANN component directory

Dump log APIs

Describes the dump log API declaration.

include/aicpu/cust_cpu_utils.h under the CANN component directory

Class NodeDefBuilder

Describes NodeDef and methods of CPU kernels.

include/aicpu/cpu_nodedef_builder.h under the CANN component directory