TIK Constructor

Description

Creates a TIK DSL container.

Prototype

__init__(profiling=None, disable_debug=True, err_msg_level=0)

Parameters

Table 1 Parameter description

Parameter

Input/Output

Description

profiling

Input

Configuration information of Ascend AI Processor version. Class Dprofile is supported.

You are advised to use the default value None. Configure the Ascend AI Processor version by using set_current_compile_soc_info.

disable_debug

Input

An optional bool for disabling debug information gathering. Defaults to True (gathering and debug disabled).

err_msg_level

Input

An optional int for specifying the level of error messages to print. Defaults to 0.

  • 0: user level. The error messages, error file paths and line numbers, error codes and contexts, and user call stacks are printed.
  • 1: developer level. The error messages, error file paths and line numbers, error codes and contexts, and all call stacks are printed.

Applicability

Atlas 200/300/500 Inference Product

Atlas Training Series Product

Restrictions

  • If debug is enabled (disable_debug set to False), the pass level decreases, affecting the operator performance.
  • If the build time is strictly limited, you can enable debug by setting disable_debug to False during operator development and delete disable_debug or set it to True in the submitted code when constructing a TIK instance to reduce build time.
  • If disable_debug is deleted or set to True and the debug API is called after BuildCCE is complete, the program exits abnormally and the debugging fails.

Returns

A TIK instance.

Example

  • The following is an example of enabling the debug function.

    If set_current_compile_soc_info is not called set the Ascend AI Processor version, tik.Tik() creates an Ascend 310 AI Processor container by default.

    The following example assumes that soc_version is Ascend910. Replace it with Ascend AI Processor version in use in your API call.

    from tbe import tik
    from tbe.common.platform import set_current_compile_soc_info
    soc_version="Ascend910"
    set_current_compile_soc_info(soc_version)
    tik_instance = tik.Tik(disable_debug=False)
  • The following is an example of disabling the debug function.
    from tbe import tik
    from tbe.common.platform import set_current_compile_soc_info
    tik_instance = tik.Tik()
    Alternatively,
    tik_instance = tik.Tik(disable_debug=True)
  • The following is an example of setting err_msg_level to the developer level.
    from tbe import tik
    from tbe.common.platform import set_current_compile_soc_info
    tik_instance = tik.Tik(err_msg_level=1)