tvm.hybrid

Hybrid Programming APIs of TVM Python Package.

This package maps a subset of python to HalideIR so that: 1. Users can write some preliminary versions of the computation patterns have not been supported yet and verify it across the real execution and python semantic emulation. 2. Developers can build HalideIR by writing Python code.

tvm.hybrid.parse(func, args) Parse a subset of Python to HalideIR
tvm.hybrid.script(pyfunc) Decorate a python function function as hybrid script.
tvm.hybrid.parse(func, args)

Parse a subset of Python to HalideIR

Parameters:
  • func (str or types.FunctionType) – If it is a string, parse the source code If it is a function, parse the function
  • args (list of Buffer or Tensor or Var) – The argument lists to the function. Leave it None if no buffer is related to the function to be parsed
Returns:

root – The result Halide IR and the parser class instance.

Return type:

Stmt

tvm.hybrid.script(pyfunc)

Decorate a python function function as hybrid script.

The hybrid function support emulation mode and parsing to the internal language IR.

Returns:hybrid_func – A decorated hybrid script function.
Return type:function