Help Center/ Atlas 300 Application (Model 3000)/ TE API Reference/ Build APIs/ te.lang.cce.cce_build_code(sch, config_map = {})
Updated on 2022-03-13 GMT+08:00

te.lang.cce.cce_build_code(sch, config_map = {})

Prints lower code or performs build for the schedule. This API is defined in cce_schedule.py.

Parameter Description

  • sch: tvm.schedule, schedule to build or to print lower code
  • config_map: build parameter configuration, which is a dictionary. The default value is {} and is used. The following keys are included:
    • print_ir: whether to print lower IR code. The default value is True.
    • need_build: whether build is performed. The default value is True.
    • name: operator name. The default value is cce_op.
    • tensor_list: list of input and output tensors of the operator. The input is the tensor object returned by the placeholder interface. The output is the calculated tensor object. The value is mandatory. Otherwise, an error is reported. In addition, this list determines the sequence of the parameters of the kernel function for operator generation, which is the same as the sequence of the input and output in the list.

Return Value

None

Calling Example

import te.lang.cce
from te import tvm
from topi import generic
# Define the input placeholder.
data = tvm.placeholder(shape, name="data", dtype=dtype)
with tvm.target.cce():
    # Describe the computation process of the operator.
    res = te.lang.cce.vabs(data)
    # Generate the schedule object.
    sch = generic.auto_schedule(res)
# Define build parameters.
config = {"print_ir" : True,
        "need_build" : True,
        "name" : "abs_28_28_float16",
        "tensor_list" : [data,res]
    }
# Build an operator.
te.lang.cce.cce_build_code(sch, config)