DSL算子的运行平台为CPU时,用于获取算子运行的上下文。
def get_ctx():
无。
在CPU上运行的算子的上下文。
无
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()