def save_runs(runs, filename):
    filename.parent.mkdir(parents=True, exist_ok=True)
    records = []
    for run in runs:
        if (run.xs is None):
            continue
        records.append(dict(task=run.task, method=run.method, seed=run.seed, xs=run.xs.tolist(), ys=run.ys.tolist()))
    runs = json.dumps(records)
    filename.write_text(runs)
    print('Saved', filename)
def save_runs(runs, filename):
    filename.parent.mkdir(parents=True, exist_ok=True)
    records = []
    for run in runs:
        if (run.xs is None):
            continue
        records.append(dict(task=run.task, method=run.method, seed=run.seed, xs=run.xs.tolist(), ys=run.ys.tolist()))
    runs = json.dumps(records)
    filename.write_text(runs)
    print('Saved', filename)