@lemo, we can do this on Relax(Relay Next).
For example, in the program on the left, we call emit_te
and pass a te/topi function to it, this will result in the IRModule
on the right shown in the TVMScript format.
Relax has symbolic integer shape as the first class, which te and topi rely on, so the integration of Relax and TE is organic and clean. Relax is an exploratory effort within TVM Unity, which allows the high-level IR to directly interact and call into lower-level TensorIR and PackedFunc, and will unlock cross-layer optimization opportunities. Please check out the links posted by @ziheng if you are interested.