forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinspector_cli.py
More file actions
76 lines (67 loc) · 2.23 KB
/
inspector_cli.py
File metadata and controls
76 lines (67 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# pyre-unsafe
import argparse
from executorch.devtools import Inspector
from executorch.devtools.inspector import compare_results, TimeScale
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument(
"--etdump_path",
required=True,
help="Provide an ETDump file path.",
)
parser.add_argument(
"--source_time_scale",
type=str,
choices=[ts.value for ts in TimeScale],
help="Enter the source time scale (ns, us, ms, s, cycles)",
default=TimeScale.NS.value,
)
parser.add_argument(
"--target_time_scale",
type=str,
choices=[ts.value for ts in TimeScale],
help="Enter the target time scale (ns, us, ms, s, cycles)",
default=TimeScale.MS.value,
)
parser.add_argument(
"--etrecord_path",
required=False,
help="Provide an optional ETRecord file path.",
)
parser.add_argument(
"--debug_buffer_path",
required=False,
help="Provide an optional buffer file path.",
)
parser.add_argument(
"--tsv_path",
required=False,
help="Provide an optional tsv file path.",
)
parser.add_argument("--compare_results", action="store_true")
args = parser.parse_args()
inspector = Inspector(
etdump_path=args.etdump_path,
etrecord=args.etrecord_path,
debug_buffer_path=args.debug_buffer_path,
source_time_scale=TimeScale(args.source_time_scale),
target_time_scale=TimeScale(args.target_time_scale),
)
inspector.print_data_tabular()
if args.tsv_path:
inspector.save_data_to_tsv(args.tsv_path)
if args.compare_results:
for event_block in inspector.event_blocks:
if event_block.name == "Execute":
compare_results(
reference_output=event_block.reference_output,
run_output=event_block.run_output,
plot=True,
)
if __name__ == "__main__":
main() # pragma: no cover