MCPcopy Create free account
hub / github.com/pytorch/executorch / get_trace_file_objects

Function get_trace_file_objects

examples/arm/visualize.py:60–73  ·  view source on GitHub ↗

Load and return the 'traceEvents' list from a gzip-compressed JSON trace file.

(trace_file_path: Path)

Source from the content-addressed store, hash-verified

58
59
60def get_trace_file_objects(trace_file_path: Path) -> list[Dict[str, Any]]:
61 """
62 Load and return the 'traceEvents' list from a gzip-compressed JSON trace file.
63 """
64 try:
65 with gzip.open(trace_file_path, "rt", encoding="utf-8") as file:
66 data = json.load(file)
67 except (OSError, json.JSONDecodeError) as e:
68 raise ValueError(f"Failed to read or parse trace file {trace_file_path}: {e}")
69
70 if "traceEvents" not in data:
71 raise KeyError(f"'traceEvents' key not found in {trace_file_path}")
72
73 return data["traceEvents"]
74
75
76def get_subops(df_group: pd.DataFrame) -> set:

Callers 1

build_overlay_dataFunction · 0.85

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected