diff --git a/security/comments_specification.md b/security/comments_specification.md index b9ff4ef..8bdebad 100644 --- a/security/comments_specification.md +++ b/security/comments_specification.md @@ -62,7 +62,10 @@ Examples: - `Raises`:异常信息,包含异常类型、含义等。 - `Examples`:样例代码。 -针对算子和Cell的注释,需要在`Examples`前添加`Inputs`和`Outputs`两项内容,用于描述实例化后,算子的输入和输出的类型和shape,输入名可以和样例相同。建议在注释中给出对应的数学公式。 +针对算子和Cell的注释,需要在`Examples`前添加`Inputs`、`Outputs`和`Supported Platforms`三项内容。 + +- `Inputs`和`Outputs`:用于描述实例化后,算子的输入和输出的类型和shape,输入名可以和样例相同。建议在注释中给出对应的数学公式。 +- `Supported Platforms`:用于描述算子支持的硬件平台,名称前后需添加``,存在多个时使用空格隔开。 ```rst Inputs: @@ -71,6 +74,9 @@ Inputs: Outputs: Type and shape, description. + +Supported Platforms: + ``Ascend`` ``GPU`` ``CPU`` ``` ### 注意事项 @@ -267,13 +273,13 @@ def ms_function(fn=None, obj=None, input_signature=None): ... return z ... >>> @ms_function - >>> def tensor_add_with_dec(x, y): + ... def tensor_add_with_dec(x, y): ... z = F.tensor_add(x, y) ... return z ... >>> @ms_function(input_signature=(MetaTensor(mindspore.float32, (1, 1, 3, 3)), ... MetaTensor(mindspore.float32, (1, 1, 3, 3)))) - >>> def tensor_add_with_sig(x, y): + ... def tensor_add_with_sig(x, y): ... z = F.tensor_add(x, y) ... return z ... diff --git a/security/comments_specification_en.md b/security/comments_specification_en.md index 3099ba9..de63ec8 100644 --- a/security/comments_specification_en.md +++ b/security/comments_specification_en.md @@ -62,7 +62,10 @@ The format items are described as follows: - `Raises`: exception information, including the exception type and meaning. - `Examples`: sample code -For comments of operators and cells, add `Inputs` and `Outputs` before `Examples` to describe the input and output types and shapes of the operators after instantiation. The input name can be the same as that in the example. It is recommended that the corresponding mathematical formula be provided in the comment. +For comments of operators and cells, add `Inputs`, `Outputs` and `Supported Platforms` before `Examples`. + +- `Inputs` and `Outputs`: describes the input and output types and shapes of the operators after instantiation. The input name can be the same as that in the example. It is recommended to provide the corresponding mathematical formula in the comment. +- `Supported Platforms`: describes the hardware platforms supported by the operator. Add `` before and after the platform name, and use space to separate them when there are more than one. ```rst Inputs: @@ -71,6 +74,9 @@ Inputs: Outputs: Type and shape, description. + +Supported Platforms: + ``Ascend`` ``GPU`` ``CPU`` ``` ### Precautions @@ -267,13 +273,13 @@ def ms_function(fn=None, obj=None, input_signature=None): ... return z ... >>> @ms_function - >>> def tensor_add_with_dec(x, y): + ... def tensor_add_with_dec(x, y): ... z = F.tensor_add(x, y) ... return z ... >>> @ms_function(input_signature=(MetaTensor(mindspore.float32, (1, 1, 3, 3)), ... MetaTensor(mindspore.float32, (1, 1, 3, 3)))) - >>> def tensor_add_with_sig(x, y): + ... def tensor_add_with_sig(x, y): ... z = F.tensor_add(x, y) ... return z ...