forked from u39kun/deep-learning-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_table.py
27 lines (22 loc) · 916 Bytes
/
create_table.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import argparse
import pickle
from tabulate import tabulate
from benchmark import models, precisions, frameworks
def print_as_table(file):
results = pickle.load(open(file, 'rb'))
rows = []
for fw in frameworks:
for precision in precisions:
precision_display = '32-bit' if precision == 'fp32' else '16-bit'
if fw in results:
row = ['{:.1f}ms'.format(v) if v > 0 else '' for v in results[fw][precision]]
rows.append([fw, precision_display] + row)
header = ['{} {}'.format(m, phase) for m in models for phase in ['eval', 'train']]
header = ['Framework', 'Precision'] + header
table = tabulate(rows, header, tablefmt="pipe")
print(table)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-f', dest='file', required=True)
args = parser.parse_args()
print_as_table(args.file)