Comment

Function

Sets the operator group information and operator prototype comments, including the operator brief and constraints. Generates operator prototype comments when the operator prototype header file is automatically generated.

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:

  • CATEGORY: Indicates that the operator group name is set in the comment.
  • BRIEF: Indicates that the comment content of the operator is in the @brief comment, that is, the description of the operator function.
  • CONSTRAINTS: Indicates that the comment is in the @Attention Constraints of the operator, namely, pay attention to the constraints of the operator.
  • RESTRICTIONS: Indicates that the comment content is in the @Restrictions comment of the operator. This option is an experimental parameter and is not recommended.
  • SEE: Indicates that the comment content is in the @see comment of the operator, which can indicate the related operators of the current operator.
  • THIRDPARTYFWKCOMPAT: Indicates that the third-party operator referenced by the operator is set in the comment content.

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");
}