[Docs] Fix outdated code examples, types, and missing references across documentation #18965
[Docs] Fix outdated code examples, types, and missing references across documentation #18965MasterJH5574 merged 2 commits intoapache:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates documentation across several files, including pass infrastructure, Relax learning materials, TensorIR learning materials, and API references. The changes include adding a 'traceable' flag to pass creation functions, updating built-in instrument documentation, and correcting variable usage in code snippets. I have reviewed the suggested changes and recommend addressing the symbolic variable shadowing issue in the Relax learning documentation by removing the redundant 'n = T.int64()' definition to ensure proper symbolic dimension tracking.
| lv1 = R.call_tir(cls.relu, (lv,), out_sinfo=R.Tensor((n, 256), dtype="float32")) | ||
| lv2 = R.call_tir(cls.linear, (lv1, w1, b1), out_sinfo=R.Tensor((n, 10), dtype="float32")) |
There was a problem hiding this comment.
While these lines correctly fix the usage of undefined variables, the definition of n on line 172 (n = T.int64()) is problematic. It introduces a new symbolic variable that shadows the symbolic dimension n from the function signature, breaking the connection between the input and intermediate tensor shapes.
For a more robust and clearer example, consider removing line 172. The n used in the R.Tensor struct infos will then correctly refer to the symbolic dimension from the input tensor's shape.
…n documentation(2) (#19344) This PR is a follow-up of #18965 - Fix incorrect variable names in Relax dataflow code example (`lv0` → `lv`, `b` → `n`) in `docs/deep_dive/relax/learning.rst` - Fix `func.time_evaluator(func.entry_name, ...)` to `func.time_evaluator("add_one", ...)` in `docs/how_to/tutorials/cross_compilation_and_rpc.py`, since `entry_name` is a class constant `"main"` but the compiled function is named `"add_one"` - Fix typo `tvfm.testing` → `tvm.testing` in `docs/how_to/dev/pytest_target_parametrization.rst` - Add missing `tvm.relax.frontend.tflite` automodule entry to `docs/reference/api/python/relax/frontend.rst`
lnumpy_matmul→lnumpy_linear,lnumpy_relu→lnumpy_relu0) and undefined variables (lv0→lv,b→n) in Relax learning tutorialI,T,Rimports in Relax and TensorIR learning tutorialspass_infra.rstto match current source: fixPassInfoNodefield order and addtraceable, correctPassContextNodearray types (
Expr→String), remove obsoleteStringImmcast inSequentialNode, and addtraceableparam toCreate*Passsignatures
PrintIRBefore/PrintAfterTODOs with already-implemented instruments (PrintBeforeAll,PrintAfterAll,PassPrintingInstrument,DumpIR)tvm.relax.op.visionandtvm.relax.op.vmto API referencePythonDomain.find_objpatch to resolve ambiguous cross-references for classes that exist in multiple TVM namespaces (e.g.StringImmin bothtvm.relaxandtvm.tirx). This is a general solution that reuses the existingtvm_class_name_rewrite_mapand also benefitsVar,Call, etc.