Explains how to use the msOpGen tool to generate, build, and deploy an Ascend C custom operator project, and how to use the msOpST tool to test the functions of the operator.
Prerequisites
You have prepared for using the msOpGen tool by referring to "Preparations" in .
Procedure
Prepare the operator prototype file by referring to the following JSON file. The MatmulCustom operator is used as an example:
[object Object]Use the msOpGen tool to run the following command to generate an operator project:
[object Object]
[object Object]After the command is executed, the following operator project directory is generated in the specified directory.
[object Object]Build the operator project.
[object Object]Deploy the custom OPP.
Run the following command to deploy the operator on CANN:
[object Object]Run the following command to deploy the operator to a custom path.
[object Object]is used as an example.[object Object]
[object Object][object Object]Run the following command to generate ST case: Replace
[object Object]with the actual project path.[object Object]Perform ST.
The following describes the Less operator's test case definition file (
[object Object]).[object Object]If the operator has attributes, the test case definition file is as follows:
[object Object]If you need to specify an input, for example, to specify the
[object Object]parameter of the ReduceSum operator, the test case definition file is as follows:[object Object]If
[object Object]of an operator is set to[object Object], the test case definition file is as follows:[object Object]The following is an example operator that allows an uncertain number of inputs (dynamic multi-input operator).
The following uses the AddN operator as an example. If the value of attribute
[object Object]is[object Object], configure three inputs with names[object Object],[object Object], and[object Object]. That is, the number of inputs must match the value of attribute[object Object].[object Object]If an input of the operator is a constant, the test case definition file is as follows:
[object Object]If the data types of the operator inputs and outputs are complex numbers, the test case definition file is as follows:
[object Object]