Skip to content

Commit 597d7f6

Browse files
committed
improves documentation
1 parent 53fa6ed commit 597d7f6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

onnx_diagnostic/helpers/torch_helper.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,16 @@ def study_discrepancies(
10281028
"""
10291029
Computes different metrics for the discrepancies.
10301030
Returns graphs.
1031+
1032+
.. plot::
1033+
:include-source:
1034+
1035+
import torch
1036+
from onnx_diagnostic.helpers.torch_helper import study_discrepancies
1037+
1038+
t1 = torch.randn((512, 1024)) * 10
1039+
t2 = t1 + torch.randn((512, 1024))
1040+
study_discrepancies(t1, t2, title="Random noise")
10311041
"""
10321042
assert t1.dtype == t2.dtype, f"Type mismatch {t1.dtype} != {t2.dtype}"
10331043
assert t1.shape == t2.shape, f"Shape mismatch {t1.shape} != {t2.shape}"

0 commit comments

Comments
 (0)