debug

Description

Enables the DSL debugging mode for TBE DSL operators, which can be used in conjunction with Python's with statement.

Prototype

def debug(target="cpu"):

Parameters

target: target operating environment of the operator. The supported values are as follows:
  • "cpu": CPU
  • "ascend_precision_model": PV Model

Default: "cpu"

Returns

The _Testing() class that contains various DSL debugging methods. For details, see the python/site-packages/tbe/common/testing/testing.py file in the CANN software installation directory.

Restrictions

None

Example

from tbe import tvm
from tbe import dsl
from tbe.common.utils import para_check
from tbe.common.utils import shape_util
# Import the API related to the testing module.
from tbe.common.testing import *
import numpy as np
# See an example custom operator whose mathematical expression is as follows:
    # C = A + B, D = C + B
    # A and B are inputs.
    # D is the output.
    # C is an intermediate tensor.
    def test_vadd_debug_api_test():
        # Enter the DSL debugging mode.
        with debug():  
            # Select the CPU as the target platform of the DSL operator.
            ctx = get_ctx()