MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / save_verification_json

Function save_verification_json

verify.py:900–932  ·  view source on GitHub ↗

Save verification results as JSON for programmatic consumption.

(result: VerificationResult, path: str)

Source from the content-addressed store, hash-verified

898
899
900def save_verification_json(result: VerificationResult, path: str) -> None:
901 """Save verification results as JSON for programmatic consumption."""
902 data = {
903 "model": result.model_name,
904 "input_shape": result.input_shape,
905 "dtype": result.dtype_str,
906 "gpu": result.gpu_name,
907 "reference": {
908 "output_shape": result.ref_output_shape,
909 "latency_ms": round(result.ref_latency_ms, 2),
910 },
911 "optimized": {
912 "output_shape": result.opt_output_shape,
913 "latency_ms": round(result.opt_latency_ms, 2),
914 "kernels_replaced": result.kernels_replaced,
915 },
916 "verification": {
917 "correctness": result.correctness,
918 "max_abs_error": result.max_abs_error,
919 "mean_abs_error": result.mean_abs_error,
920 "has_nan": result.has_nan,
921 "has_inf": result.has_inf,
922 },
923 "summary": {
924 "original_latency_ms": round(result.ref_latency_ms, 2),
925 "optimized_latency_ms": round(result.opt_latency_ms, 2),
926 "end_to_end_speedup": round(result.end_to_end_speedup, 3),
927 "kernels_replaced": len(result.kernels_replaced),
928 },
929 }
930
931 with open(path, "w") as f:
932 json.dump(data, f, indent=2)
933
934
935# ---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected