Skip to main content
Article·tvm.apache.org
edgecompileroptimizationinferencehardwaredeep-learning

Apache TVM

Apache TVM is an open-source ML compiler optimizing deep learning workloads across various hardware. It automates model optimization using AutoTVM and Ansor, achieving high inference performance on edge devices. It is a versatile tool for deploying ML models.

intermediate30 min3 steps
The play
  1. Install TVM
    Install Apache TVM and its dependencies. Use pip to install the tvm package and its required dependencies.
  2. Verify Installation
    Verify the installation by importing tvm and checking its version.
  3. Example: Compile a Simple Model
    Define a simple model (e.g., adding two tensors) and compile it using TVM.
Starter code
import tvm
from tvm import te
import numpy as np

n = te.var("n")
A = te.placeholder((n,), name='A')
B = te.placeholder((n,), name='B')
C = te.compute(A.shape, lambda i: A[i] + B[i], name='C')

s = te.create_schedule(C.op)
f = tvm.build(s, [A, B, C], target='llvm', name='myadd')
Source
Apache TVM — Action Pack