python/tvm/relay/build_module.py
def build(mod, target=None, target_host=None, params=None):"""函数功能:构建一个在TVM图形运行时运行的Relay函数。参数:mod : relay.Module要构建的模块。使用relay.Function已被废弃。target : str, :any:`tvm.target.Target`, or dict of str(i.e. device/context name) to str/tvm.target.Target, optional对于异构编译,它是一个表示上下文到目标映射的字典。对于同构编译,它是一个构建目标。target_host : str or :any:`tvm.target.Target`, optional主机编译目标,如果目标是设备。当TVM编译特定设备的程序时,比如CUDA,我们还需要主机(CPU)端代码与驱动交互,正确设置尺寸和参数。 target_host用于指定主机端代码生成目标。默认情况下,如果启用了llvm,则使用llvm,否则使用堆栈解释器。params : dict of str to NDArraygraph的输入参数,在推理阶段不变,用于常量折叠返回值-------graph_json : strgraph运行时可接受的json字符串mod : tvm.Module包含必要库的模块params : dictgraph的参数"""
python/tvm/contrib/graph_runtime.py
def build(mod, target=None, target_host=None, params=None):"""函数功能:构建一个在TVM图形运行时运行的Relay函数。参数:mod : relay.Module要构建的模块。使用relay.Function已被废弃。target : str, :any:`tvm.target.Target`, or dict of str(i.e. device/context name) to str/tvm.target.Target, optional对于异构编译,它是一个表示上下文到目标映射的字典。对于同构编译,它是一个构建目标。target_host : str or :any:`tvm.target.Target`, optional主机编译目标,如果目标是设备。当TVM编译特定设备的程序时,比如CUDA,我们还需要主机(CPU)端代码与驱动交互,正确设置尺寸和参数。 target_host用于指定主机端代码生成目标。默认情况下,如果启用了llvm,则使用llvm,否则使用堆栈解释器。params : dict of str to NDArraygraph的输入参数,在推理阶段不变,用于常量折叠返回值-------graph_json : strgraph运行时可接受的json字符串mod : tvm.Module包含必要库的模块params : dictgraph的参数"""
