Skip to content

Commit 81890a1

Browse files
authored
improves documentation (#21)
* improves documentation * fix thumb * title
1 parent f7bdb1a commit 81890a1

8 files changed

+14
-11
lines changed

_doc/examples/plot_export_locate_issue.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,8 @@ def forward(self, x: torch.Tensor, ys: list[torch.Tensor]):
103103
# File "onnx-diagnostic/_doc/examples/plot_export_locate_issue.py", line 25, in forward
104104
# z = x * caty
105105

106+
# %%
106107

107-
doc.plot_legend("was inferred to be a constant", "torch.export.export", "tomato")
108+
doc.plot_legend(
109+
"dynamic dimension\nwas inferred\nto be a constant", "torch.export.export", "tomato"
110+
)

_doc/examples/plot_export_tiny_llm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,4 @@ def _forward_(*args, _f=None, **kwargs):
174174
# If you have any error, then look at example
175175
# :ref:`l-plot-tiny-llm-export-patched`.
176176

177-
doc.plot_legend("Tiny-LLM fails", "torch.export.export", "tomato")
177+
doc.plot_legend("Tiny-LLM\nforward inputs\nbehind generate", "torch.export.export", "tomato")

_doc/examples/plot_export_with_dynamic_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,4 @@ def forward(self, cache, z):
225225

226226
# %%
227227

228-
doc.plot_legend("dynamic shapes", "torch.export.export", "tomato")
228+
doc.plot_legend("dynamic shapes\nfor cache", "torch.export.export", "tomato")

_doc/examples/plot_export_with_dynamic_shapes_auto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ def forward(self, x, y, z):
9494

9595
# %%
9696

97-
doc.plot_legend("dynamic shapes inferred", "torch.export.export", "tomato")
97+
doc.plot_legend("dynamic shapes\ninferred", "torch.export.export", "tomato")

_doc/examples/plot_failing_model_extract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@
100100

101101
# %%
102102

103-
doc.plot_legend("Run until it fails", "onnxruntime.InferenceSession", "lightgrey")
103+
doc.plot_legend("run onnx model\nuntil it fails", "onnxruntime.InferenceSession", "lightgrey")

_doc/examples/plot_failing_onnxruntime_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@
106106
# It is possible to insert prints in the python code to print
107107
# more information or debug if needed.
108108

109-
doc.plot_legend("onnxruntime running step by step", "OnnxruntimeEvaluator", "lightgrey")
109+
doc.plot_legend("onnxruntime\nrunning\nstep by step", "OnnxruntimeEvaluator", "lightgrey")

_doc/examples/plot_failing_reference_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@
8181
# It is possible to insert prints in the python code to print
8282
# more information or debug if needed.
8383

84-
doc.plot_legend("Python Runtime for ONNX", "ExtendedReferenceEvalutor", "lightgrey")
84+
doc.plot_legend("Python Runtime\nfor ONNX", "ExtendedReferenceEvalutor", "lightgrey")

onnx_diagnostic/doc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ def reset_torch_transformers(gallery_conf, fname):
88

99

1010
def plot_legend(
11-
text: str, text_bottom: str = "", color: str = "green", fontsize: int = 35
11+
text: str, text_bottom: str = "", color: str = "green", fontsize: int = 15
1212
) -> "matplotlib.axes.Axes": # noqa: F821
1313
import matplotlib.pyplot as plt
1414

15-
fig = plt.figure()
15+
fig = plt.figure(figsize=(2, 2))
1616
ax = fig.add_subplot()
1717
ax.axis([0, 5, 0, 5])
18-
ax.text(2.5, 4, "END", fontsize=50, horizontalalignment="center")
18+
ax.text(2.5, 4, "END", fontsize=10, horizontalalignment="center")
1919
ax.text(
2020
2.5,
2121
2.5,
@@ -26,7 +26,7 @@ def plot_legend(
2626
verticalalignment="center",
2727
)
2828
if text_bottom:
29-
ax.text(4.5, 0.5, text_bottom, fontsize=20, horizontalalignment="right")
29+
ax.text(4.5, 0.5, text_bottom, fontsize=7, horizontalalignment="right")
3030
ax.grid(False)
3131
ax.set_axis_off()
3232
return ax

0 commit comments

Comments
 (0)