Home / Function/ output_csv() — pytorch Function Reference

output_csv() — pytorch Function Reference

Architecture documentation for the output_csv() function in common.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  abb63394_bfce_d4ac_0ee7_71617c357328["output_csv()"]
  3473d1a5_c1f5_fc97_006e_79a1d3081bef["write_outputs()"]
  3473d1a5_c1f5_fc97_006e_79a1d3081bef -->|calls| abb63394_bfce_d4ac_0ee7_71617c357328
  style abb63394_bfce_d4ac_0ee7_71617c357328 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/common.py lines 336–351

def output_csv(filename, headers, row):
    if os.path.exists(filename):
        with open(filename) as fd:
            lines = list(csv.reader(fd)) or [[]]
            if headers and len(headers) > len(lines[0]):
                # if prior results failed the header might not be filled in yet
                lines[0] = headers
            else:
                headers = lines[0]
    else:
        lines = [headers]
    lines.append([(f"{x:.6f}" if isinstance(x, float) else x) for x in row])
    with open(filename, "w") as fd:
        writer = csv.writer(fd, lineterminator="\n")
        for line in lines:
            writer.writerow(list(line) + ["0"] * (len(headers) - len(line)))

Subdomains

Called By

Frequently Asked Questions

What does output_csv() do?
output_csv() is a function in the pytorch codebase.
What calls output_csv()?
output_csv() is called by 1 function(s): write_outputs.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free