_write_results_to_json() — pytorch Function Reference
Architecture documentation for the _write_results_to_json() function in cachebench.py from the pytorch codebase.
Entity Profile
Dependency Diagram
graph TD 4c5d5750_9c4f_4bb3_15ed_612570273bef["_write_results_to_json()"] e68c7f5d_5584_dd88_8af3_2bcda2115580["main()"] e68c7f5d_5584_dd88_8af3_2bcda2115580 -->|calls| 4c5d5750_9c4f_4bb3_15ed_612570273bef style 4c5d5750_9c4f_4bb3_15ed_612570273bef fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
benchmarks/dynamo/cachebench.py lines 146–184
def _write_results_to_json(
cmd_args: argparse.Namespace,
results: list[RunResult],
) -> None:
if len(results) == 0:
# do not write empty results
return
records = []
for result in results:
for metric_name, value in [
("Cold compile time (s)", result.cold_compile_s),
("Warm compile time (s)", result.warm_compile_s),
("Speedup (%)", [result.speedup_pct]),
]:
records.append(
{
"benchmark": {
"name": "TorchCache Benchmark",
"mode": result.mode,
"extra_info": {
"is_dynamic": result.dynamic,
"device": result.device,
},
},
"model": {
"name": result.model,
"backend": "inductor",
"origins": [result.benchmark],
},
"metric": {
"name": metric_name,
"type": "OSS model",
"benchmark_values": value,
},
}
)
with open(cmd_args.output, "w") as f:
json.dump(records, f)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _write_results_to_json() do?
_write_results_to_json() is a function in the pytorch codebase.
What calls _write_results_to_json()?
_write_results_to_json() is called by 1 function(s): main.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free