Comment
Function Usage
Sets the operator group information and operator prototype comments, including the operator brief and constraints, and generates operator prototype comments when the operator prototype header file is automatically generated.
Based on the operator prototype definition, the custom operator project can automatically generate the operator prototype definition REG_OP that is used in the graph mode. You can use the generated operator prototype to perform operations such as graph construction, build, and execution.
The generated comments help understand the operator prototype and can be used to automatically generate the operator prototype documentation. Generally, built-in CANN operators are widely used. Developers can use them as required.
Prototype
1
|
OpDef &Comment(CommentSection section, const char *comment) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
section |
Input |
The CommentSection class is used to specify the function of the API. The following values are supported:
|
|
comment |
Input |
Add a comment. |
Returns
OpDef operator definition. For details, see OpDef.
Constraints
When you use the CATEGORY parameter to set the operator group name, a code file with the same name is generated. If the overlong file name exceeds the limit of the tar package name during building, an error is reported.
For details, see File Name Is Too Long During Operator Project Compilation.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
AddCustomComment(const char* name) : OpDef(name) { this->Comment(CommentSection::CATEGORY, "catg"); // Operator Group this->Comment(CommentSection::BRIEF, "Brief cmt") // BRIEF comment .Comment(CommentSection::CONSTRAINTS, "Constraints cmt 1") // CONSTRAINTS comment .Comment(CommentSection::CONSTRAINTS, "Constraints cmt2"); this->Comment (CommentSection::RESTRICTIONS, "Restrictions cmt1") // RESTRICTIONS comment .Comment(CommentSection::RESTRICTIONS, "Restrictions cmt2") .Comment(CommentSection::THIRDPARTYFWKCOMPAT, "Third-party framework compatibility cmt1") // THIRDPARTYFWKCOMPAT comments .Comment(CommentSection::THIRDPARTYFWKCOMPAT, "Third-party framework compatibility cmt2") .Comment(CommentSection::SEE, "See cmt1")// SEE comment .Comment(CommentSection::SEE, "See cmt2"); this->Input("x") .ParamType(REQUIRED) .DataType({ge::DT_FLOAT, ge::DT_INT32}) .FormatList({ge::FORMAT_ND}); this->Input("y") .ParamType(REQUIRED) .DataType({ge::DT_FLOAT, ge::DT_INT32}) .FormatList({ge::FORMAT_ND}); this->Output("z") .ParamType(REQUIRED) .DataType({ge::DT_FLOAT, ge::DT_INT32}) .FormatList({ge::FORMAT_ND}); this->AICore() .SetTiling(optiling::TilingFunc); this->AICore().AddConfig("ascendxxx"); } |