Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
63d6fe67
提交
63d6fe67
authored
12月 12, 2015
作者:
gw0 [http://gw.tnode.com/]
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Import pydot-ng with pydot as fallback.
上级
d7e653ab
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
23 行增加
和
33 行删除
+23
-33
__init__.py
theano/d3viz/__init__.py
+6
-4
formatting.py
theano/d3viz/formatting.py
+6
-4
printing.py
theano/printing.py
+11
-25
没有找到文件。
theano/d3viz/__init__.py
浏览文件 @
63d6fe67
...
...
@@ -2,8 +2,10 @@ from theano.d3viz.d3viz import d3viz, d3write
has_requirements
=
False
try
:
import
pydot
as
pd
if
pd
.
find_graphviz
():
has_requirements
=
True
# pydot-ng is a fork of pydot that is better maintained
import
pydot_ng
as
pd
except
ImportError
:
pass
# fall back on pydot if necessary
import
pydot
as
pd
if
pd
.
find_graphviz
():
has_requirements
=
True
theano/d3viz/formatting.py
浏览文件 @
63d6fe67
...
...
@@ -16,11 +16,13 @@ from theano.compile import builders
pydot_imported
=
False
try
:
import
pydot
as
pd
if
pd
.
find_graphviz
():
pydot_imported
=
True
# pydot-ng is a fork of pydot that is better maintained
import
pydot_ng
as
pd
except
ImportError
:
pass
# fall back on pydot if necessary
import
pydot
as
pd
if
pd
.
find_graphviz
():
pydot_imported
=
True
class
PyDotFormatter
(
object
):
...
...
theano/printing.py
浏览文件 @
63d6fe67
...
...
@@ -22,25 +22,15 @@ from theano.gof import Op, Apply
from
theano.compile
import
Function
,
debugmode
,
SharedVariable
from
theano.compile.profilemode
import
ProfileMode
# pydot-ng is a fork of pydot that is better maintained, and works
# with more recent version of its dependencies (in particular pyparsing)
pydot_imported
=
False
try
:
# pydot-ng is a fork of pydot that is better maintained
import
pydot_ng
as
pd
if
pd
.
find_graphviz
():
pydot_imported
=
True
else
:
pydot_imported
=
False
except
Exception
:
# Sometimes, a Windows-specific exception is raised
pydot_imported
=
False
# Fall back on pydot if necessary
if
not
pydot_imported
:
try
:
import
pydot
as
pd
if
pd
.
find_graphviz
():
pydot_imported
=
True
except
Exception
:
pass
except
ImportError
:
# fall back on pydot if necessary
import
pydot
as
pd
if
pd
.
find_graphviz
():
pydot_imported
=
True
_logger
=
logging
.
getLogger
(
"theano.printing"
)
VALID_ASSOC
=
set
([
'left'
,
'right'
,
'either'
])
...
...
@@ -733,7 +723,6 @@ def pydotprint(fct, outfile=None,
if
not
pydot_imported
:
raise
RuntimeError
(
"Failed to import pydot. You must install pydot"
" and graphviz for `pydotprint` to work."
)
return
g
=
pd
.
Dot
()
...
...
@@ -1065,13 +1054,10 @@ def pydotprint_variables(vars,
if
outfile
is
None
:
outfile
=
os
.
path
.
join
(
config
.
compiledir
,
'theano.pydotprint.'
+
config
.
device
+
'.'
+
format
)
try
:
import
pydot
as
pd
except
ImportError
:
err
=
(
"Failed to import pydot. You must install pydot for "
+
"`pydotprint_variables` to work."
)
print
(
err
)
return
if
not
pydot_imported
:
raise
RuntimeError
(
"Failed to import pydot. You must install pydot"
" and graphviz for `pydotprint_variables` to work."
)
g
=
pd
.
Dot
()
my_list
=
{}
orphanes
=
[]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论