Skip to content

Commit e31eb56

Browse files
author
Juntian Liu
authored
Inspector APIs Doc Updates
Differential Revision: D78692027 Pull Request resolved: #12688
1 parent d158236 commit e31eb56

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
@@ -1376,17 +1376,19 @@ def get_exported_program(
13761376
else self._etrecord.graph_map.get(graph)
13771377
)
13781378

1379-
def calculate_numeric_gap(self, distance: str = "MSE") -> pd.DataFrame:
1379+
def calculate_numeric_gap(self, distance: str = "MSE"):
13801380
"""
13811381
Compares logged intermediate outputs from the exported graph (in ETRecord)
13821382
with runtime outputs (in ETDump) using a user-specific numerical comparator.
1383+
To use this function, you must first generate the ETRecord using the `bundle_program`,
1384+
and then create the Inspector instance with the ETRecord and ETDump. The Inspector can then
1385+
compare the intermediate outputs from the AOT and the runtime.
13831386
13841387
Args:
13851388
distance: the metrics the inspector will use for gap calculation. Should be one of "MSE", "L1" and "SNR".
13861389
13871390
Returns:
1388-
pd.DataFrame: A DataFrame listing corresponding operator outputs from
1389-
both stages and their computed numerical gaps.
1391+
pd.DataFrame: A DataFrame listing corresponding operator intermediate outputs from both stages and their computed numerical gaps.
13901392
"""
13911393
aot_intermediate_outputs, aot_debug_handle_to_op_names = (
13921394
self._get_aot_intermediate_outputs_and_op_names()
249 KB
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)