提交 1bc83396 authored 作者: Mohammad Pezeshki's avatar Mohammad Pezeshki

now profile is obj.profile for any kind of obj and not only function

上级 f9aec00b
......@@ -6,10 +6,9 @@ from theano.printing import debugprint
X = T.matrix('X')
W = T.matrix('W')
Y = T.dot(X, W)
R = X - W
Z = Y + R
Z = X - W
f = theano.function(inputs=[X, W], outputs=[Z, R], profile=True)
f = theano.function(inputs=[X, W], outputs=[Y, Z], profile=False)
for i in xrange(10):
f(numpy.random.uniform(size=(2, 2)),
numpy.random.uniform(size=(2, 2)))
......
......@@ -73,7 +73,6 @@ def debugprint(obj, depth=-1, print_type=False,
to the Apply's identifier, to indicate which output a line corresponds to.
"""
profile = None
if file == 'str':
_file = StringIO()
elif file is None:
......@@ -95,10 +94,6 @@ def debugprint(obj, depth=-1, print_type=False,
elif isinstance(obj, Function):
results_to_print.extend(obj.maker.fgraph.outputs)
order = obj.maker.fgraph.toposort()
profile = obj.profile
if profile != None:
print 'Timing Info\n-----------\n\t \
--> <time> <% time> - <total time> <% total time>'
elif isinstance(obj, gof.FunctionGraph):
results_to_print.extend(obj.outputs)
order = obj.toposort()
......@@ -117,6 +112,11 @@ def debugprint(obj, depth=-1, print_type=False,
isinstance(r.owner.op, theano.scan_module.scan_op.Scan)):
scan_ops.append(r)
profile = obj.profile
if profile != None:
print 'Timing Info\n-----------\n\t \
--> <time> <% time> - <total time> <% total time>'
debugmode.debugprint(r, depth=depth, done=done, print_type=print_type,
file=_file, order=order, ids=ids,
scan_ops=scan_ops, stop_on_name=stop_on_name,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论