Skip to content

[Docs] Fix outdated code examples, types, and missing references across documentation #18965

Merged
MasterJH5574 merged 2 commits intoapache:mainfrom
tlopex:doc1322
Apr 4, 2026
Merged

[Docs] Fix outdated code examples, types, and missing references across documentation #18965
MasterJH5574 merged 2 commits intoapache:mainfrom
tlopex:doc1322

Conversation

@tlopex
Copy link
Copy Markdown
Member

@tlopex tlopex commented Apr 2, 2026

  • Fix incorrect function names (lnumpy_matmullnumpy_linear, lnumpy_relulnumpy_relu0) and undefined variables (lv0lv,
    bn) in Relax learning tutorial
  • Add missing I, T, R imports in Relax and TensorIR learning tutorials
  • Update pass_infra.rst to match current source: fix PassInfoNode field order and add traceable, correct PassContextNode
    array types (ExprString), remove obsolete StringImm cast in SequentialNode, and add traceable param to Create*Pass
    signatures
  • Replace stale PrintIRBefore/PrintAfter TODOs with already-implemented instruments (PrintBeforeAll, PrintAfterAll,
    PassPrintingInstrument, DumpIR)
  • Add missing tvm.relax.op.vision and tvm.relax.op.vm to API reference
  • Add PythonDomain.find_obj patch to resolve ambiguous cross-references for classes that exist in multiple TVM namespaces (e.g. StringImm in both tvm.relax and tvm.tirx). This is a general solution that reuses the existing tvm_class_name_rewrite_map and also benefits Var, Call, etc.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +174 to +175
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"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Copy link
Copy Markdown
Contributor

@MasterJH5574 MasterJH5574 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@MasterJH5574 MasterJH5574 merged commit 6601962 into apache:main Apr 4, 2026
10 checks passed
MasterJH5574 pushed a commit that referenced this pull request Apr 5, 2026
…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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants