In this example, an XIR OP add is implemented. It adds two input tensors, assuming that both the tensors have the same shape.
To register a new XIR OP, refer to the Vitis AI User Guide (UG1414). This example assumes that the add OP is already registered in the Xmodel graph.
For a complete reference golden code, refer to https://github.com/Xilinx/Vitis-AI/demo/Custom_OP_Demo/op_add.
To implement an XIR OP, follow these steps.
- Write a C++ class.
- Write the constructor function.
- Write the calculate function.
- Register the implementation with the macro.
- Build a shared library.
- Deploy it.