File size: 391 Bytes
0e8e964
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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