Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
13b76018
提交
13b76018
authored
5月 13, 2016
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4505 from kmike/d3viz
d3viz improvements for Python 3
上级
91686c6d
ef69ec1d
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
35 行增加
和
13 行删除
+35
-13
.travis.yml
.travis.yml
+1
-1
advanced_theano.txt
doc/cifarSC2011/advanced_theano.txt
+1
-1
advanced_theano.txt
doc/crei2013/advanced_theano.txt
+1
-1
install.txt
doc/install.txt
+2
-2
index.ipynb
doc/library/d3viz/index.ipynb
+0
-0
index.txt
doc/library/d3viz/index.txt
+19
-3
d3viz.py
theano/d3viz/d3viz.py
+5
-1
formatting.py
theano/d3viz/formatting.py
+3
-2
printing.py
theano/printing.py
+3
-2
没有找到文件。
.travis.yml
浏览文件 @
13b76018
...
...
@@ -35,7 +35,7 @@ install:
-
if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then conda create --yes -q -n pyenv mkl python=2.6 numpy=1.7.1 scipy=0.11 nose=1.3.0 pyparsing=1.5 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx; fi
-
if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then conda create --yes -q -n pyenv mkl python=3.3 numpy=1.9.1 scipy=0.14.0 nose=1.3.4 pyparsing=1.5 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx; fi
-
source activate pyenv
-
if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install pydot; fi
-
if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install pydot;
else pip install pydot-ng;
fi
-
pip install . --no-deps
-
pip install flake8-future-import nose-parameterized==0.5.0
...
...
doc/cifarSC2011/advanced_theano.txt
浏览文件 @
13b76018
...
...
@@ -464,7 +464,7 @@ The graph after optimization:
Picture Printing of Graphs
~~~~~~~~~~~~~~~~~~~~~~~~~~
``pydotprint`` requires graphviz and
pydot
.
``pydotprint`` requires graphviz and
either pydot or pydot-ng
.
The graph before optimization:
...
...
doc/crei2013/advanced_theano.txt
浏览文件 @
13b76018
...
...
@@ -202,7 +202,7 @@ The graph after optimization:
Picture Printing of Graphs
~~~~~~~~~~~~~~~~~~~~~~~~~~
``pydotprint`` requires graphviz and
pydot
.
``pydotprint`` requires graphviz and
either pydot or pydot-ng
.
The graph before optimization:
...
...
doc/install.txt
浏览文件 @
13b76018
...
...
@@ -59,7 +59,7 @@ The following libraries and software are optional:
`Git <http://git-scm.com>`_
To download bleeding-edge versions of Theano.
`
pydot-ng <https://github.com/pydot/pydot-ng>`_ or `pydot <https://code.google.com/p/pydot/>`
_
`
graphiz <http://www.graphviz.org/>`__ and either `pydot-ng <https://github.com/pydot/pydot-ng>`__ or `pydot <https://code.google.com/p/pydot/>`_
_
To be able to make picture of Theano computation graph.
pydot-ng is a pydot compatible replacement that support newer Python.
...
...
@@ -613,7 +613,7 @@ To install the missing Theano optional dependency (pydot):
.. code-block:: bash
$ conda install pydot
$ conda install pydot
-ng
If you want the bleeding edge version instead execute this command:
...
...
doc/library/d3viz/index.ipynb
浏览文件 @
13b76018
This source diff could not be displayed because it is too large. You can
view the blob
instead.
doc/library/d3viz/index.txt
浏览文件 @
13b76018
...
...
@@ -17,11 +17,14 @@ Requirements
------------
``d3viz`` requires the `pydot <https://pypi.python.org/pypi/pydot>`__
package, which can be installed with ``pip``:
package. `pydot-ng <https://github.com/pydot/pydot-ng>`__ fork is better
maintained, and it works both in Python 2.x and 3.x. Install it with pip::
::
pip install pydot-ng
pip install pydot
Like Theano’s `printing module
<http://deeplearning.net/software/theano/library/printing.html>`__, ``d3viz``
requires `graphviz <http://www.graphviz.org/>`__ binary to be available.
Overview
--------
...
...
@@ -123,6 +126,19 @@ may not be perfect. In this case, you can press the ``Release node``
button in the top-left corner to automatically arrange nodes. To reset
nodes to their default position, press the ``Reset nodes`` button.
You can also display the interactive graph inline in
IPython using ``IPython.display.IFrame``:
.. code:: python
from IPython.display import IFrame
d3v.d3viz(predict, 'examples/mlp.html')
IFrame('examples/mlp.html', width=700, height=500)
Currently if you use display.IFrame you still have to create a file,
and this file can't be outside notebooks root (e.g. usually it can't be
in /tmp/).
Profiling
---------
...
...
theano/d3viz/d3viz.py
浏览文件 @
13b76018
...
...
@@ -7,6 +7,7 @@ from __future__ import absolute_import, print_function, division
import
os
import
shutil
import
re
import
six
from
six
import
iteritems
from
theano.d3viz.formatting
import
PyDotFormatter
...
...
@@ -78,7 +79,10 @@ def d3viz(fct, outfile, copy_deps=True, *args, **kwargs):
# Create DOT graph
formatter
=
PyDotFormatter
(
*
args
,
**
kwargs
)
graph
=
formatter
(
fct
)
dot_graph
=
escape_quotes
(
str
(
graph
.
create_dot
()))
.
replace
(
'
\n
'
,
''
)
.
replace
(
'
\r
'
,
''
)
dot_graph_raw
=
graph
.
create_dot
()
if
not
six
.
PY2
:
dot_graph_raw
=
dot_graph_raw
.
decode
(
'utf8'
)
dot_graph
=
escape_quotes
(
dot_graph_raw
)
.
replace
(
'
\n
'
,
''
)
.
replace
(
'
\r
'
,
''
)
# Create output directory if not existing
outdir
=
os
.
path
.
dirname
(
outfile
)
...
...
theano/d3viz/formatting.py
浏览文件 @
13b76018
...
...
@@ -52,8 +52,9 @@ class PyDotFormatter(object):
def
__init__
(
self
,
compact
=
True
):
"""Construct PyDotFormatter object."""
if
not
pydot_imported
:
raise
ImportError
(
'Failed to import pydot. You must install pydot'
' and graphviz for `PyDotFormatter` to work.'
)
raise
ImportError
(
'Failed to import pydot. You must install '
'graphviz and either pydot or pydot-ng for '
'`PyDotFormatter` to work.'
)
self
.
compact
=
compact
self
.
node_colors
=
{
'input'
:
'limegreen'
,
...
...
theano/printing.py
浏览文件 @
13b76018
...
...
@@ -747,8 +747,9 @@ def pydotprint(fct, outfile=None,
outputs
=
fct
.
outputs
topo
=
fct
.
toposort
()
if
not
pydot_imported
:
raise
RuntimeError
(
"Failed to import pydot. You must install pydot"
" and graphviz for `pydotprint` to work."
,
raise
RuntimeError
(
"Failed to import pydot. You must install graphviz"
" and either pydot or pydot-ng for "
"`pydotprint` to work."
,
pydot_imported_msg
)
g
=
pd
.
Dot
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论