Merge source table with performance metrics and total NPU cycles. Returns a tuple of (src_df, cmd_to_op_df) where df_cmd_to_op is needed for unmapped op tracking.
(tables: Tables, perf_df: pd.DataFrame)
| 183 | |
| 184 | |
| 185 | def build_src_df(tables: Tables, perf_df: pd.DataFrame) -> pd.DataFrame: |
| 186 | """ |
| 187 | Merge source table with performance metrics and total NPU cycles. |
| 188 | Returns a tuple of (src_df, cmd_to_op_df) where df_cmd_to_op is needed for unmapped op tracking. |
| 189 | """ |
| 190 | return pd.merge( |
| 191 | tables.source.rename(columns={"id": "source_id"})[["ext_key", "source_id"]], |
| 192 | perf_df, |
| 193 | on="source_id", |
| 194 | how="left", |
| 195 | ).merge( |
| 196 | tables.perf[["source_id", "npu_cycles"]] |
| 197 | .groupby("source_id") |
| 198 | .sum(numeric_only=True) |
| 199 | .reset_index(), |
| 200 | on="source_id", |
| 201 | how="left", |
| 202 | ) |
| 203 | |
| 204 | |
| 205 | def get_model_node_data(df: pd.DataFrame) -> ndb.ModelNodeData: |
no outgoing calls
no test coverage detected