Comment

Function Usage

Sets the operator category information and operator prototype comments, including the brief and constraints. This API can be used to generate operator prototype comments when the operator prototype header file is automatically generated.

Prototype

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 category name is set in the comment.
  • BRIEF: Indicates that @brief of the operator is set in the comment, that is, the brief description of the operator function.
  • CONSTRAINTS: Indicates that @Attention Constraints of the operator is set in the comment, that is, the constraints of the operator.
  • RESTRICTIONS: Indicates that @Restrictions of the operator is set in the comment. This option is an experimental parameter and is not recommended.
  • SEE: Indicates that @see of the operator is set in the comment, which indicates the related operators of the current operator.
  • THIRDPARTYFWKCOMPAT: Indicates that the third-party operator referenced by the operator is set in the comment.

comment

Input

Comment to be added.

Returns

OpDef operator definition. For details, see OpDef.

Constraints

When you use the CATEGORY parameter to set the operator category name, a code file with the same name is generated. An overlong file name may exceed the limit of the tar package name during build, causing an error.

For details, see File Name Is Too Long During Operator Project Compilation.

Example

 AddCustomComment(const char* name) : OpDef(name)
{
	this->Comment(CommentSection::CATEGORY, "catg"); // Operator category
	this->Comment(CommentSection::BRIEF, "Brief cmt") // BRIEF comment
	        .Comment(CommentSection::CONSTRAINTS, "Constraints cmt 1") // CONSTRAINTS comment
	        .Comment(CommentSection::CONSTRAINTS, "Constraints cmt 2");
	this->Comment(CommentSection::RESTRICTIONS, "Restrictions cmt") // RESTRICTIONS comment
		.Comment(CommentSection::RESTRICTIONS, "Restrictions cmt")
		.Comment(CommentSection::THIRDPARTYFWKCOMPAT, "ThirdParnyFwkCopat cmt") // THIRDPARTYFWKCOMPAT comment
		.Comment(CommentSection::THIRDPARTYFWKCOMPAT, "ThirdPartyFwkCopat cmt")
		.Comment(CommentSection::SEE, "See cmt")// SEE comment
		.Comment(CommentSection::SEE, "Seen cmt");
	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");
}