<jupyter_start><jupyter_text>Compare TensorRT EnginesUse this Jupyter worksheet to compare two or more TensorRT Engine plans.  Load JSON Files<jupyter_code>import IPython
from ipywidgets import widgets
from trex import *

# Configure a wider output (for the wide graphs)
set_wide_display()

engine_name_1 = "../tests/inputs/mobilenet.qat.onnx.engine"
engine_name_2 = "../tests/inputs/mobilenet_v2_residuals.qat.onnx.engine"

plan1 = EnginePlan(f'{engine_name_1}.graph.json', f'{engine_name_1}.profile.json', f"{engine_name_1}.metadata.json")
plan2 = EnginePlan(f'{engine_name_2}.graph.json', f'{engine_name_2}.profile.json', f"{engine_name_2}.metadata.json")<jupyter_output><empty_output><jupyter_text>SummaryIt is helpful to look at a high-level summary of the engine plan before diving into the details.<jupyter_code>plans = (plan1, plan2)
summary_dicts = [plan.summary_dict() for plan in plans]
merged_summaries = stack_dicts(summary_dicts, empty_placeholder="")

df = pd.DataFrame.from_dict(merged_summaries)
df['plan'] = get_plans_names(plans)
df = rotate_columns(df)

display_df(df)


compare_engines_overview(plans=(plan1, plan2))
report_card_perf_overview(plan1);
report_card_perf_overview(plan2);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11417004048582996, 'fraction_numerical': 0.013765182186234818, 'mean_word_length': 7.892086330935252, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '108232', 'license': 'Apache-2.0', 'n_tokens_mistral': 454, 'n_tokens_neox': 442, 'n_words': 85, 'path': 'tools/experimental/trt-engine-explorer/notebooks/compare_engines.ipynb', 'repo_name': 'GreyZzzzzzXh/TensorRT', 'size': '1235'}