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

Function check_unmapped_ops

examples/arm/visualize.py:158–182  ·  view source on GitHub ↗

Identify operators in the performance data that are not mapped to any source operation.

(
    tables: Tables, src_df: pd.DataFrame, cmd_to_op_df: pd.DataFrame
)

Source from the content-addressed store, hash-verified

156
157
158def check_unmapped_ops(
159 tables: Tables, src_df: pd.DataFrame, cmd_to_op_df: pd.DataFrame
160) -> None:
161 """
162 Identify operators in the performance data that are not mapped to any source operation.
163 """
164 opt_ids_in_src_table = set()
165 for opt_ids in src_df[COMPILER_OP_ID].dropna():
166 if type(opt_ids) is list:
167 opt_ids_in_src_table.update(opt_ids)
168
169 opt_df = pd.merge(
170 tables.perf[["id", "source_id"]], tables.group, on="id", how="left"
171 )
172 opt_df = opt_df.rename(columns={"id": COMPILER_OP_ID})
173 opt_df = pd.merge(opt_df, cmd_to_op_df, on=COMPILER_OP_ID, how="inner")
174
175 unmapped_operators = opt_df[
176 ~opt_df[COMPILER_OP_ID].isin(list(opt_ids_in_src_table))
177 ]
178
179 if not unmapped_operators.empty:
180 print("Warning: There are unmapped operators in the performance data.")
181 print(unmapped_operators)
182 return None
183
184
185def build_src_df(tables: Tables, perf_df: pd.DataFrame) -> pd.DataFrame:

Callers 1

build_overlay_dataFunction · 0.85

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected