get_ctx
Description
Obtains the execution context of the DSL operator when CPU is used as the target platform.
Prototype
def get_ctx():
Parameters
None
Returns
Execution context of the operator on the CPU.
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()
Parent topic: TBE DSL Testing API