Sample Overview
Function Usage
This sample verifies the functionality of the custom operator by converting the custom operator file into a single-operator offline model file and loading the file using the pyacl for execution.
This sample implements the matrix-matrix addition operation: C = A + B. In this operation, A, B, and C are 8 x 16 matrices and are of the int32 type. The result is an 8 x 16 matrix.
Main APIs
The following table lists the main APIs.
Initialization |
|
|---|---|
Device management |
|
Stream management |
|
Memory management |
|
Data transfer |
If your app runs on the host, call the acl.rt.memcpy API.
Data transfer is not required if your app runs in the board environment. |
Single-operator calling |
|
Directory Structure
The following is an example of the directory structure after the model file is converted:
acl_operator_add
├──scripts
│ ├── host_version.conf // Version number configuration file.
│ └── testcase_300.sh // Run script.
├──src
│ ├── acl_execute_add.py // Running file
│ └── constant.py // Constant definition
└── test_data
├── config
│ ├── acl.json // Configuration file for system initialization
│ └── add_op.json // Description information of the matrix-matrix addition operator
└── op_models // Directory generated after ATC conversion.
└── 0_Add_3_2_8_16_3_2_8_16_3_2_8_16.om //Model file of the matrix addition operator
Parent topic: Matrix-Matrix Addition