Updated on 2022-03-13 GMT+08:00

Including Header Files

Use the #include command in the header of the plug-in implementation file to include the header files related to the plug-in implementation functions in the plug-in implementation source file.

#include "custom/custom_op.h"
#include "framework/omg/register.h"
#include "framework/omg/omg_types.h"
#include "proto/caffe/caffe.pb.h"
#include "operator.h"
#include "attr_value.h"
#include <memory>
#include <string>
#include <vector>
Table 1 Description of header files

Header File

Category

Function

custom/custom_op.h

/include/inc/custom/custom_op.h in the DDK installation directory

User-defined functions for building, operator debugging, and operator verification can be called once this header file is included.

framework/omg/register.h

/include/inc/framework/omg/register.h in the DDK installation directory

Class operator registration can be used and APIs of class operator registration can be called once this hearer file is included.

framework/omg/omg_types.h

/include/inc/framework/omg/omg_types.h in the DDK installation directory

TBE custom operator information structure TEBinInfo can be used once this header file is included.

proto/caffe/caffe.pb.h

proto/caffe/caffe.pb.h generated in the directory of the operator project during the building of an operator plug-in

When the operator plug-in is built, the /include/inc/custom/proto/caffe/caffe.proto file in the DDK installation directory is automatically built, and the proto/caffe/caffe.pb.h file is generated in the directory of the operator project for the plug-in code to call to parse operator parameters.

operator.h

include/inc/graph/operator.h in the DDK installation directory.

APIs for setting/obtaining operator attributes and setting input/output can be called once this header file is included.

attr_value.h

/include/inc/graph/attr_value.h in the DDK installation directory

Data types of class AttrValue can be used once this header file is included.

memory

C++ standard library

Smart pointers, memory allocators, temporary functions for allocating and releasing dynamic memory, and functions for constructing memory objects in the C++ standard library can be called once this header file is included.

string

C++ standard library

Class string can be used to construct objects APIs of class string can be called once this header file is included.

vector

C++ standard library

Vector templates can be used and APIs of class vector can be called once this header file is included.

Before the operator plug-in is built, ignore the following message (the project does not have the proto/caffe/caffe.pb.h file).

Figure 1 Message indicating a caffe.pb.h parsing failure