Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
84c9c685
提交
84c9c685
authored
4月 22, 2016
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Better pydotprint error message
上级
dba69909
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
3 行删除
+12
-3
printing.py
theano/printing.py
+12
-3
没有找到文件。
theano/printing.py
浏览文件 @
84c9c685
...
@@ -23,19 +23,26 @@ from theano.compile import Function, debugmode, SharedVariable
...
@@ -23,19 +23,26 @@ from theano.compile import Function, debugmode, SharedVariable
from
theano.compile.profilemode
import
ProfileMode
from
theano.compile.profilemode
import
ProfileMode
pydot_imported
=
False
pydot_imported
=
False
pydot_imported_msg
=
""
try
:
try
:
# pydot-ng is a fork of pydot that is better maintained
# pydot-ng is a fork of pydot that is better maintained
import
pydot_ng
as
pd
import
pydot_ng
as
pd
if
pd
.
find_graphviz
():
if
pd
.
find_graphviz
():
pydot_imported
=
True
pydot_imported
=
True
else
:
pydot_imported_msg
=
"pydot-ng can't find graphviz"
except
ImportError
:
except
ImportError
:
try
:
try
:
# fall back on pydot if necessary
# fall back on pydot if necessary
import
pydot
as
pd
import
pydot
as
pd
if
pd
.
find_graphviz
():
if
pd
.
find_graphviz
():
pydot_imported
=
True
pydot_imported
=
True
else
:
pydot_imported_msg
=
"pydot can't find graphviz"
except
ImportError
:
except
ImportError
:
pass
# tests should not fail on optional dependency
# tests should not fail on optional dependency
pydot_imported_msg
=
"Install the python package pydot or pydot-ng."
_logger
=
logging
.
getLogger
(
"theano.printing"
)
_logger
=
logging
.
getLogger
(
"theano.printing"
)
VALID_ASSOC
=
set
([
'left'
,
'right'
,
'either'
])
VALID_ASSOC
=
set
([
'left'
,
'right'
,
'either'
])
...
@@ -728,7 +735,8 @@ def pydotprint(fct, outfile=None,
...
@@ -728,7 +735,8 @@ def pydotprint(fct, outfile=None,
topo
=
fct
.
toposort
()
topo
=
fct
.
toposort
()
if
not
pydot_imported
:
if
not
pydot_imported
:
raise
RuntimeError
(
"Failed to import pydot. You must install pydot"
raise
RuntimeError
(
"Failed to import pydot. You must install pydot"
" and graphviz for `pydotprint` to work."
)
" and graphviz for `pydotprint` to work."
,
pydot_imported_msg
)
g
=
pd
.
Dot
()
g
=
pd
.
Dot
()
...
@@ -1063,7 +1071,8 @@ def pydotprint_variables(vars,
...
@@ -1063,7 +1071,8 @@ def pydotprint_variables(vars,
config
.
device
+
'.'
+
format
)
config
.
device
+
'.'
+
format
)
if
not
pydot_imported
:
if
not
pydot_imported
:
raise
RuntimeError
(
"Failed to import pydot. You must install pydot"
raise
RuntimeError
(
"Failed to import pydot. You must install pydot"
" and graphviz for `pydotprint_variables` to work."
)
" and graphviz for `pydotprint_variables` to work."
,
pydot_imported_msg
)
if
pd
.
__name__
==
"pydot_ng"
:
if
pd
.
__name__
==
"pydot_ng"
:
raise
RuntimeError
(
"pydotprint_variables do not support pydot_ng."
raise
RuntimeError
(
"pydotprint_variables do not support pydot_ng."
"pydotprint_variables is also deprecated, "
"pydotprint_variables is also deprecated, "
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论