Skip to content

Commit ee245ec

Browse files
Inspector APIs Doc Updates (#12701)
Summary: This PR updates the Inspector APIs' documentation to introduce the calculate_numeric_gap for the executorch 0.7 release. Differential Revision: D78692027 Co-authored-by: Juntian Liu <[email protected]>
1 parent 82d763b commit ee245ec

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

devtools/inspector/_inspector.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,17 +1362,19 @@ def get_exported_program(
13621362
else self._etrecord.graph_map.get(graph)
13631363
)
13641364

1365-
def calculate_numeric_gap(self, distance: str = "MSE") -> pd.DataFrame:
1365+
def calculate_numeric_gap(self, distance: str = "MSE"):
13661366
"""
13671367
Compares logged intermediate outputs from the exported graph (in ETRecord)
13681368
with runtime outputs (in ETDump) using a user-specific numerical comparator.
1369+
To use this function, you must first generate the ETRecord using the `bundle_program`,
1370+
and then create the Inspector instance with the ETRecord and ETDump. The Inspector can then
1371+
compare the intermediate outputs from the AOT and the runtime.
13691372
13701373
Args:
13711374
distance: the metrics the inspector will use for gap calculation. Should be one of "MSE", "L1" and "SNR".
13721375
13731376
Returns:
1374-
pd.DataFrame: A DataFrame listing corresponding operator outputs from
1375-
both stages and their computed numerical gaps.
1377+
pd.DataFrame: A DataFrame listing corresponding operator intermediate outputs from both stages and their computed numerical gaps.
13761378
"""
13771379
aot_intermediate_outputs, aot_debug_handle_to_op_name = (
13781380
self._get_aot_intermediate_outputs_and_op_names()
Loading

docs/source/model-inspector.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ get_exported_program
106106
Equality constraints: []
107107

108108

109+
calculate_numeric_gap
110+
~~~~~~~~~~~~~~~~~~
111+
112+
.. autofunction:: executorch.devtools.Inspector.calculate_numeric_gap
113+
114+
.. _example-usage-4:
115+
116+
**Example Usage:**
117+
118+
.. code:: python
119+
120+
print(inspector.calculate_numeric_gap("L1"))
121+
122+
.. image:: _static/img/calculate_numeric_gap.png
123+
109124
Inspector Attributes
110125
--------------------
111126

0 commit comments

Comments
 (0)