Custom Operator Implementation and Registration - 2.0 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2022-01-20
Version
2.0 English

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.

  1. Write a C++ class.
  2. Write the constructor function.
  3. Write the calculate function.
  4. Register the implementation with the macro.
  5. Build a shared library.
  6. Deploy it.