Implementing and Registering Custom Operators - 3.5 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2023-06-29
Version
3.5 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 which means the model with add OP has been compiled successfully by Vitis AI xcompiler.

For a complete reference golden code, see Customized XIR OP example.

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.