Updated on 2022-03-13 GMT+08:00

Importing Python Modules

Import the Python modules provided by the Ascend AI software stack. The sample code is provided as follows.

import te.lang.cce
from te import tvm
from topi import generic

In the preceding information:

  • te.lang.cce: introduces the SDL APIs supported by TE, including common ones such as vmuls, vadds, and matmul.

    For details about the interface definition, see the Python functions in the /site-packages/te-0.4.0.egg/te/lang/cce/ directory in the DDK installation path. For details about how to use the Python functions, see the TE API Reference.

  • te.tvm: introduces the code generation mechanism of the TVM.

    For details about the interface definition, see the Python functions in the /site-packages/te-0.4.0.egg/te/tvm directory in the DDK installation path. For details about how to use the Python functions, visit https://docs.tvm.ai/.

  • topi.generic: provides the API for automatic operator scheduling.

    For details about the interface definition, see the Python functions in the /site-packages/topi-0.4.0.egg/topi/generic directory in the DDK installation path. For details about how to use the Python functions, see the TE API Reference.