Repository navigation
Use raw strings and :math: roles for LaTeX in the Stiefel retraction … - #318
Merged
Merged
Conversation
…and ObliqueSteepestSGD docstrings Signed-off-by: August Vi <augustvilakia@gmail.com>
Contributor
[Low impact] The PR appears safe to merge. SummaryFixes LaTeX in five docstrings without changing optimizer behavior.
Reviews (2) · Last reviewed commit: "Drop the W605 lint rule" · Reviewed by Greptile |
Contributor
|
Dropping W605 change can make review simpler |
Signed-off-by: August Vi <augustvilakia@gmail.com>
Contributor
Author
|
@skyw Hey I dropped W605 change |
skyw
approved these changes
Oct 21, 2026
Contributor
|
/ok to test 898505b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The four retraction docstrings in
riemannian_optimizers/retractions/stiefel.pyand theObliqueSteepestSGDdocstring are plain"""strings that contain LaTeX in$...$. Python reads the backslashes as escape sequences, which causes three problems:\S,\eand\|are invalid escapes. Compilingstiefel.pyprints threeSyntaxWarnings, for example on the first import from a source checkout or whenexamples/nanogpt/train.pystarts.\tand\fare valid escapes, so\textturns into a TAB followed byext,\tointo a TAB followed byo, and\fracinto a form feed followed byrac.help()and IDE tooltips show the corrupted text.$...$math. In a local Sphinx build ofdocs/, theObliqueSteepestSGDentry shows$l_1 <TAB>o <TAB>ext{RMS}$as plain text. Fixing the escapes alone would still render it as$l_1 to text{RMS}$.This PR makes those docstrings raw strings and writes the math with
:math:roles, as the rest of the package does (for exampleprocrustes_step.py:34). Because the strings are now raw,step\\_sizebecomesstep\_size. No code changes.Before and after
On
main:Rendered
apidocs/riemannian-optimizers.htmlonmain:With this change:
Verification
tests/test_normalized_optimizer.py: 36 OKtests/test_isospectral.py: 17 OKtests/test_spel.py: 32 OKsphinx-build -b html docs docs/_build/html: no new warningspre-commit run --files <changed files>: all hooks pass