Sample Obtaining
You can obtain the operator sample code from the /home/HwHiAiUser/Ascend/ascend-toolkit/latest/atc/sample/op folder in the development environment.
- The caffe directory stores the sample code of the Caffe custom operator project.
- The tensorflow directory stores the sample code of the TensorFlow custom operator project.
- The all directory stores the sample code of both the Caffe and TensorFlow custom operator projects.
The all directory stores the sample code of the TBE custom operators and AI CPU custom operators on the TensorFlow and Caffe frameworks. This following describes only the parsing of the TBE custom operator samples.
Note: The custom operator feature in the current AI CPU version is a trial feature and is subject to change in future releases. Do not apply it in commercial products.
- The singleop directory stores the sample code for operator implementation using TIK, which contains only the Python operator implementations. These single-operators can be called only by using the AscendCL API.
For details about the implementation process and sample of the batch_norm operator in the singleop/tbe/impl directory, see TIK Custom Operator with Dynamic Shape.
If the developed custom operator is used to build an IR model or will be called as a single-operator, you do not need to develop the operator plug-in. You can select from the caffe, tensorflow, or all directory as the project directory. For projects in the caffe and all directory, you do not need to edit the custom.proto file before building an operator.