提交 3b9975eb authored 作者: Piotr Frankowski's avatar Piotr Frankowski

fix according to comments

上级 abc28761
...@@ -351,25 +351,28 @@ def print_compiledir_content(): ...@@ -351,25 +351,28 @@ def print_compiledir_content():
for dir in os.listdir(compiledir): for dir in os.listdir(compiledir):
filename = os.path.join(compiledir, dir, "key.pkl") filename = os.path.join(compiledir, dir, "key.pkl")
with open(filename, 'rb') as file: with open(filename, 'rb') as file:
keydata = pickle.load(file) try:
ops = list(set([x for x in flatten(keydata.keys) keydata = pickle.load(file)
if isinstance(x, theano.gof.Op)])) ops = list(set([x for x in flatten(keydata.keys)
if len(ops) == 0: if isinstance(x, theano.gof.Op)]))
zeros_op += 1 if len(ops) == 0:
elif len(ops) > 1: zeros_op += 1
more_than_one_ops += 1 elif len(ops) > 1:
else: more_than_one_ops += 1
types = list(set([x for x in flatten(keydata.keys) else:
if isinstance(x, theano.gof.Type)])) types = list(set([x for x in flatten(keydata.keys)
table.append((dir, ops[0], types)) if isinstance(x, theano.gof.Type)]))
table.append((dir, ops[0], types))
size = os.path.getsize(filename)
total_key_sizes += size size = os.path.getsize(filename)
if size > max_key_file_size: total_key_sizes += size
big_key_files.append((dir, size, ops)) if size > max_key_file_size:
big_key_files.append((dir, size, ops))
nb_keys.setdefault(len(keydata.keys), 0)
nb_keys[len(keydata.keys)] += 1 nb_keys.setdefault(len(keydata.keys), 0)
nb_keys[len(keydata.keys)] += 1
except IOError:
pass
print("List of %d compiled individual ops in this theano cache %s:" % ( print("List of %d compiled individual ops in this theano cache %s:" % (
len(table), compiledir)) len(table), compiledir))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论