Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2d9b16b9
提交
2d9b16b9
authored
8月 31, 2016
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make SkipTest give a better error. Remove duplicate code
上级
3896827b
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
10 行增加
和
28 行删除
+10
-28
formatting.py
theano/d3viz/formatting.py
+3
-22
test_d3viz.py
theano/d3viz/tests/test_d3viz.py
+2
-2
test_formatting.py
theano/d3viz/tests/test_formatting.py
+2
-2
printing.py
theano/printing.py
+3
-2
没有找到文件。
theano/d3viz/formatting.py
浏览文件 @
2d9b16b9
...
@@ -14,25 +14,7 @@ from theano import gof
...
@@ -14,25 +14,7 @@ from theano import gof
from
theano.compile.profilemode
import
ProfileMode
from
theano.compile.profilemode
import
ProfileMode
from
theano.compile
import
Function
from
theano.compile
import
Function
from
theano.compile
import
builders
from
theano.compile
import
builders
from
theano.printing
import
pd
,
pydot_imported
,
pydot_imported_msg
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
except
ImportError
:
try
:
# fall back on pydot if necessary
import
pydot
as
pd
if
hasattr
(
pd
,
'find_graphviz'
):
if
pd
.
find_graphviz
():
pydot_imported
=
True
else
:
pd
.
Dot
.
create
(
pd
.
Dot
())
pydot_imported
=
True
except
ImportError
:
pass
# tests should not fail on optional dependency
class
PyDotFormatter
(
object
):
class
PyDotFormatter
(
object
):
...
@@ -56,9 +38,8 @@ class PyDotFormatter(object):
...
@@ -56,9 +38,8 @@ class PyDotFormatter(object):
def
__init__
(
self
,
compact
=
True
):
def
__init__
(
self
,
compact
=
True
):
"""Construct PyDotFormatter object."""
"""Construct PyDotFormatter object."""
if
not
pydot_imported
:
if
not
pydot_imported
:
raise
ImportError
(
'Failed to import pydot. You must install '
raise
ImportError
(
'Failed to import pydot. '
+
'graphviz and either pydot or pydot-ng for '
pydot_imported_msg
)
'`PyDotFormatter` to work.'
)
self
.
compact
=
compact
self
.
compact
=
compact
self
.
node_colors
=
{
'input'
:
'limegreen'
,
self
.
node_colors
=
{
'input'
:
'limegreen'
,
...
...
theano/d3viz/tests/test_d3viz.py
浏览文件 @
2d9b16b9
...
@@ -11,9 +11,9 @@ import theano.d3viz as d3v
...
@@ -11,9 +11,9 @@ import theano.d3viz as d3v
from
theano.d3viz.tests
import
models
from
theano.d3viz.tests
import
models
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
from
theano.d3viz.formatting
import
pydot_imported
from
theano.d3viz.formatting
import
pydot_imported
,
pydot_imported_msg
if
not
pydot_imported
:
if
not
pydot_imported
:
raise
SkipTest
(
'
Missing requirements'
)
raise
SkipTest
(
'
pydot not available: '
+
pydot_imported_msg
)
class
TestD3Viz
(
unittest
.
TestCase
):
class
TestD3Viz
(
unittest
.
TestCase
):
...
...
theano/d3viz/tests/test_formatting.py
浏览文件 @
2d9b16b9
...
@@ -8,9 +8,9 @@ from theano.d3viz.formatting import PyDotFormatter
...
@@ -8,9 +8,9 @@ from theano.d3viz.formatting import PyDotFormatter
from
theano.d3viz.tests
import
models
from
theano.d3viz.tests
import
models
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
from
theano.d3viz.formatting
import
pydot_imported
from
theano.d3viz.formatting
import
pydot_imported
,
pydot_imported_msg
if
not
pydot_imported
:
if
not
pydot_imported
:
raise
SkipTest
(
'
Missing requirements'
)
raise
SkipTest
(
'
pydot not available: '
+
pydot_imported_msg
)
class
TestPyDotFormatter
(
unittest
.
TestCase
):
class
TestPyDotFormatter
(
unittest
.
TestCase
):
...
...
theano/printing.py
浏览文件 @
2d9b16b9
...
@@ -30,7 +30,7 @@ try:
...
@@ -30,7 +30,7 @@ try:
if
pd
.
find_graphviz
():
if
pd
.
find_graphviz
():
pydot_imported
=
True
pydot_imported
=
True
else
:
else
:
pydot_imported_msg
=
"pydot-ng can't find graphviz"
pydot_imported_msg
=
"pydot-ng can't find graphviz
. Install graphviz.
"
except
ImportError
:
except
ImportError
:
try
:
try
:
# fall back on pydot if necessary
# fall back on pydot if necessary
...
@@ -45,7 +45,8 @@ except ImportError:
...
@@ -45,7 +45,8 @@ except ImportError:
pydot_imported
=
True
pydot_imported
=
True
except
ImportError
:
except
ImportError
:
# 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."
pydot_imported_msg
=
(
"Install the python package pydot or pydot-ng."
" Install graphviz."
)
_logger
=
logging
.
getLogger
(
"theano.printing"
)
_logger
=
logging
.
getLogger
(
"theano.printing"
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论