yaourt.tools.js_profile#
Functions to process profiling output from onnxruntime.
- yaourt.tools.js_profile.js_profile_to_dataframe(filename: str, as_df: bool = True, first_it_out: bool = False, agg: bool = False, agg_op_name: bool = False, with_shape: bool = False) List | DataFrame#
Reads an onnxruntime profiling file and returns its content.
- Parameters:
filename – filename holding the profiling stored in json format
as_df – returns a DataFrame when True, otherwise a list of dicts
first_it_out – if aggregated, leaves the first iteration out
agg – aggregates by event
agg_op_name – aggregates on operator name or operator index
with_shape – keeps the shape before aggregating
- Returns:
DataFrame or list of dicts
- yaourt.tools.js_profile.plot_ort_profile(df: DataFrame, ax0: matplotlib.axes.Axes | None = None, ax1: matplotlib.axes.Axes | None = None, title: str | None = None) matplotlib.axes.Axes#
Plots time spent in computation based on a profiling dataframe.
The input dataframe should be produced by
js_profile_to_dataframe().- Parameters:
df – dataframe produced by
js_profile_to_dataframe()ax0 – first axis to draw time (created if None)
ax1 – second axis to draw occurrences (optional)
title – graph title
- Returns:
the axes used for drawing
- yaourt.tools.js_profile.plot_ort_profile_timeline(df: DataFrame, ax: matplotlib.axes.Axes | None = None, iteration: int = -2, title: str | None = None, quantile: float = 0.5, fontsize: int = 12) matplotlib.axes.Axes#
Creates a timeline plot from an onnxruntime profiling dataframe.
The input dataframe should be produced by
js_profile_to_dataframe().- Parameters:
df – dataframe produced by
js_profile_to_dataframe()ax – axis to draw (created if None)
iteration – iteration to plot; negative values count from the end
title – graph title
quantile – operators below this quantile of duration are drawn in a different colour
fontsize – font size
- Returns:
the axis used for drawing
- yaourt.tools.js_profile.post_process_df_profile(df: DataFrame, first_it_out: bool = False, agg: bool = False, agg_op_name: bool = True, with_shape: bool = False) DataFrame#
Post-processes a dataframe obtained after profiling onnxruntime.
Adds a column for a more explicit event name and adds a column for the iteration number.
- Parameters:
df – dataframe produced by
js_profile_to_dataframe()agg – aggregates the result
first_it_out – leaves the first iteration out of the aggregation
agg_op_name – aggregates on operator name or operator index
with_shape – keeps the shape to aggregate
- Returns:
post-processed DataFrame