提交 74ee0d01 authored 作者: Mohammad Pezeshki's avatar Mohammad Pezeshki

profile_list is now a list of profiles

上级 1bc83396
......@@ -8,7 +8,7 @@ W = T.matrix('W')
Y = T.dot(X, W)
Z = X - W
f = theano.function(inputs=[X, W], outputs=[Y, Z], profile=False)
f = theano.function(inputs=[X, W], outputs=[Y, Z], profile=True)
for i in xrange(10):
f(numpy.random.uniform(size=(2, 2)),
numpy.random.uniform(size=(2, 2)))
......
......@@ -81,6 +81,7 @@ def debugprint(obj, depth=-1, print_type=False,
_file = file
done = dict()
results_to_print = []
profile_list = []
order = []
if isinstance(obj, (list, tuple)):
lobj = obj
......@@ -89,18 +90,26 @@ def debugprint(obj, depth=-1, print_type=False,
for obj in lobj:
if isinstance(obj, gof.Variable):
results_to_print.append(obj)
profile_list.append(None)
elif isinstance(obj, gof.Apply):
results_to_print.extend(obj.outputs)
for item in obj.outputs:
profile_list.append(obj.profile)
elif isinstance(obj, Function):
results_to_print.extend(obj.maker.fgraph.outputs)
for item in obj.maker.fgraph.outputs:
profile_list.append(obj.profile)
order = obj.maker.fgraph.toposort()
elif isinstance(obj, gof.FunctionGraph):
results_to_print.extend(obj.outputs)
for item in obj.outputs:
profile_list.append(obj.profile)
order = obj.toposort()
elif isinstance(obj, (int, long, float, numpy.ndarray)):
print obj
elif isinstance(obj, (theano.In, theano.Out)):
results_to_print.append(obj.variable)
profile_list.append(None)
else:
raise TypeError("debugprint cannot print an object of this type",
obj)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论