apache / apache/tvm

[Bug] How to migrate from te.create_schedule and auto_scheduler to TVM v0.20’

Open
#17,914 2 comments 0 reactions 0 assignees View on GitHub
needs-triage type: bug
Dominant language
Python
Stars
13.7k
Forks
4k
Avg merge
2d 19h
Merged PRs (30d)
111

Description

I am using the release of v0.20. migrating from V0.19. The following function seems to have been deprecated. Can you show me a migration guide or functions that can replace it? Thanks

---
AttributeError: module 'tvm.te' has no attribute 'create_schedule'
```
s = te.create_schedule(C.op)
```

---
ImportError: cannot import name 'auto_scheduler' from 'tvm' (/home/doc/tvm/python/tvm/__init__.py). Did you mean: 'meta_schedule'?
```
from tvm import te, auto_scheduler
```
---
The simple TVM code that work with v0.19 are:
```
import tvm
from tvm import te

import numpy as np

# Define the computation
n = te.var("n") # symbolic variable
A = te.placeholder((n,), name="A")
B = te.placeholder((n,), name="B")
C = te.compute((n,), lambda i: A[i] + B[i], name="C")

# Schedule the computation
s = te.create_schedule(C.op)

# Build the function
fadd = tvm.build(s, [A, B, C], target="llvm", name="vector_add")

# Prepare input data
n_val = 8
a_np = np.random.uniform(size=n_val).astype("float32")
b_np = np.random.uniform(size=n_val).astype("float32")
c_np = np.zeros(n_val, dtype="float32")

# Allocate TVM buffers
ctx = tvm.cpu()
a_tvm = tvm.nd.array(a_np, ctx)
b_tvm = tvm.nd.array(b_np, ctx)
c_tvm = tvm.nd.array(c_np, ctx)

# Run the function
fadd(a_tvm, b_tvm, c_tvm)

# Validate correctness
np.testing.assert_allclose(c_tvm.asnumpy(), a_np + b_np)
print("Success! Output:", c_tvm.asnumpy())
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the v0.19 Python example and the reported entry points `te.create_schedule`, `tvm.auto_scheduler`, and `meta_schedule`. Verify the v0.20 replacements and document a migration path for both scheduling and auto-scheduling, including an updated vector-add example. Done means the guide explains the replacement APIs clearly enough to resolve both reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.