提交 c331362f authored 作者: Frederic's avatar Frederic

Small fix to pydotprint_variables

上级 bbf5269a
......@@ -992,7 +992,7 @@ def pydotprint_variables(vars,
if nd.owner:
plot_apply(nd.owner, depth)
try:
g.write_png(outfile, prog='dot')
g.write(outfile, prog='dot', format=format)
except pd.InvocationException, e:
# Some version of pydot are bugged/don't work correctly with
# empty label. Provide a better user error message.
......@@ -1006,6 +1006,7 @@ def pydotprint_variables(vars,
" Theano. Using another version of pydot could"
" fix this problem. The pydot error is: " +
e.message)
raise
print 'The output file is available at', outfile
......
......@@ -11,6 +11,7 @@ import theano.tensor as tensor
from theano.printing import min_informative_str, debugprint
from theano.compat.six import StringIO
def test_pydotprint_cond_highlight():
"""
This is a REALLY PARTIAL TEST.
......@@ -44,6 +45,37 @@ def test_pydotprint_cond_highlight():
' is no IfElse node in the graph\n')
def test_pydotprint_variables():
"""
This is a REALLY PARTIAL TEST.
I did them to help debug stuff.
It make sure the code run.
"""
# Skip test if pydot is not available.
if not theano.printing.pydot_imported:
raise SkipTest('pydot not available')
x = tensor.dvector()
s = StringIO()
new_handler = logging.StreamHandler(s)
new_handler.setLevel(logging.DEBUG)
orig_handler = theano.logging_default_handler
theano.theano_logger.removeHandler(orig_handler)
theano.theano_logger.addHandler(new_handler)
theano.theano_logger.removeHandler(orig_handler)
theano.theano_logger.addHandler(new_handler)
try:
theano.printing.pydotprint_variables(x * 2)
finally:
theano.theano_logger.addHandler(orig_handler)
theano.theano_logger.removeHandler(new_handler)
def test_pydotprint_long_name():
"""This is a REALLY PARTIAL TEST.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论