Sample Reference

Sample Obtaining and Using

Feature

How to Obtain

Availability

Constructing a graph and building it into an offline model

Click IRBuild to obtain the sample. For details, see the readme file.

Atlas inference products: supported

Atlas training products: supported

Atlas 200I/500 A2 inference products: supported

Atlas A2 training products/Atlas A2 inference products: supported

Atlas A3 training products/Atlas A3 inference products: supported

Constructing a graph and directly building and running the graph

Click graph_run to obtain the sample. For details, see the readme file.

Atlas inference products: supported

Atlas training products: supported

Atlas 200I/500 A2 inference products: not supported

Atlas A2 training products/Atlas A2 inference products: supported

Atlas A3 training products/Atlas A3 inference products: supported

Modifying the Tile+Concat graph structure to the Concat+Tile+Concat graph structure using a custom pass

Click 1_fuse_tile_concat_pass to obtain the sample. For details, see the readme file.

Atlas inference products: supported

Atlas training products: supported

Atlas 200I/500 A2 inference products: supported

Atlas A2 training products/Atlas A2 inference products: supported

Atlas A3 training products/Atlas A3 inference products: supported

Modifying the MatMul+Add graph structure to the GEMM graph structure using a custom pass

Click 2_fuse_matmul_add_pass to obtain the sample. For details, see the readme file.

Atlas inference products: supported

Atlas training products: supported

Atlas 200I/500 A2 inference products: supported

Atlas A2 training products/Atlas A2 inference products: supported

Atlas A3 training products/Atlas A3 inference products: supported

Modifying a subgraph using a custom pass and inserting an Abs node into the Data+FrameworkOp structure of the subgraph

Click 3_modify_subgraph_pass to obtain the sample. For details, see the readme file.

Atlas inference products: supported

Atlas training products: supported

Atlas 200I/500 A2 inference products: supported

Atlas A2 training products/Atlas A2 inference products: supported

Atlas A3 training products/Atlas A3 inference products: supported

Precautions for Using the Build Script

The sample provides a build script, which requires only few manual tweaks to the following variables.

  • ASCEND_PATH: Installation path of the CANN software package.
  • INCLUDES: header files to be included. Append new header files (if any) to the existing lines. Do not delete the existing lines. If the network contains a custom operator, include the header file of its prototype definition.
  • LIBS: libraries to be linked. Append new libraries (if any) to the existing lines. Do not delete the original lines.

    Do not link with other .so files in the runfile, as this may cause compatibility problems during version upgrade.

Environment Variables for Running an Application

After the CANN package is installed, log in to the environment as the CANN operating user and run the source $INSTALL_DIR/set_env.sh command to set environment variables. Replace ${INSTALL_DIR} with the CANN component directory. For example, if the installation is performed by the root user, the default file storage path is /usr/local/Ascend/cann.

This section only provides the environment variables required for running applications. For the full list of environment variables, see Environment Variables.