import json def export_policy(report, path="curvopt_policy.json"): policy = { r["layer"]: { "precision": r["precision"], "iwcs": round(r["iwcs"], 4), "energy_saved": round(r["energy_before"] - r["energy_after"], 4) } for r in report } with open(path, "w") as f: json.dump(policy, f, indent=2) return path