debug

函数功能

针对TBE DSL算子的实现,可通过此接口配合python with语句,进入DSL调试模式。

函数原型

def debug():

参数说明

返回值

_Testing()类,包含DSL调试功能的各种方法,详细定义于可参见CANN软件安装后文件存储路径的“python/site-packages/tbe/common/testing/testing.py”文件。

约束说明

调用示例

from tbe import tvm
from tbe import dsl
from tbe.common.utils import para_check
from tbe.common.utils import shape_util
# 引入testing模块相关接口
from tbe.common.testing import *
import numpy as np
#这边我们想模拟实现一个自定义算子,算子的数学表达式如下所示:
    # C = A + B, D = C + B
    # A,B是输入
    # D是输出
    # C是某个中间Tensor
    def test_vadd_debug_api_test():
        # 进入DSL调试模式
        with debug():  
            # 选择CPU作为DSL的运行平台
            ctx = get_ctx()