Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
91a00e6f
提交
91a00e6f
authored
7月 22, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1979 from nouiz/fct_dump
Add function_dump() to help user give us reproducable example.
上级
60b5ccc2
36d3c0b6
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
110 行增加
和
6 行删除
+110
-6
conv.txt
doc/library/tensor/nnet/conv.txt
+2
-0
debug_faq.txt
doc/tutorial/debug_faq.txt
+26
-0
__init__.py
theano/__init__.py
+1
-1
__init__.py
theano/compile/__init__.py
+1
-1
function.py
theano/compile/function.py
+22
-0
test_function.py
theano/compile/tests/test_function.py
+28
-0
cutils.py
theano/gof/cutils.py
+11
-2
lazylinker_c.py
theano/gof/lazylinker_c.py
+6
-1
vm.py
theano/gof/vm.py
+6
-0
scan_perform_ext.py
theano/scan_module/scan_perform_ext.py
+7
-1
没有找到文件。
doc/library/tensor/nnet/conv.txt
浏览文件 @
91a00e6f
...
...
@@ -50,6 +50,8 @@ TODO: Give examples for how to use these things! They are pretty complicated.
<http://deeplearning.net/software/pylearn2/library/linear.html>`_
implementation.
Also, there is restrictions on which shape are supported.
.. autofunction:: theano.tensor.nnet.conv.conv2d
.. autofunction:: theano.tensor.nnet.Conv3D.conv3D
.. autofunction:: theano.tensor.nnet.conv3d2d.conv3d
...
...
doc/tutorial/debug_faq.txt
浏览文件 @
91a00e6f
...
...
@@ -410,3 +410,29 @@ the function itself (a "thunk" is a concept related to closures). Here, to
get the current node's first input's shape, you'd therefore do "p
thunk.inputs[0][0].shape", which prints out "(3, 4)".
.. _faq_dump_fct:
Dumping a Function to help debug
--------------------------------
If you are reading this, there is high chance that you emailed our
mailing list and we asked you to read this section. This section
explain how to dump all the parameter passed to
``theano.function()``. This is useful to help us reproduce a problem
during compilation and it don't request you to make a self contained
example.
For this to work, we need to be able to import the code for all Op in
the graph. So if you create your own Op, we will need this
code. Otherwise, we won't be able to unpickle it. We already have all
the Ops from Theano and Pylearn2.
.. code-block:: python
# Replace this line:
theano.function(...)
# with
theano.function_dump(filename, ...)
# Where filename is a string to a file that we will write to.
Then send us filename.
theano/__init__.py
浏览文件 @
91a00e6f
...
...
@@ -57,7 +57,7 @@ from theano.compile import \
SymbolicOutput
,
Out
,
\
Mode
,
\
predefined_modes
,
predefined_linkers
,
predefined_optimizers
,
\
FunctionMaker
,
function
,
OpFromGraph
,
\
FunctionMaker
,
function
,
function_dump
,
OpFromGraph
,
\
Component
,
External
,
Member
,
Method
,
\
Composite
,
ComponentList
,
ComponentDict
,
Module
,
\
ProfileMode
,
ProfileStats
,
\
...
...
theano/compile/__init__.py
浏览文件 @
91a00e6f
...
...
@@ -28,4 +28,4 @@ from theano.compile.pfunc import pfunc, Param, rebuild_collect_shared
from
theano.compile.builders
import
*
from
theano.compile.function
import
function
from
theano.compile.function
import
function
,
function_dump
theano/compile/function.py
浏览文件 @
91a00e6f
...
...
@@ -2,6 +2,7 @@
"""
__docformat__
=
"restructuredtext en"
import
cPickle
import
logging
_logger
=
logging
.
getLogger
(
'theano.compile.function'
)
...
...
@@ -12,6 +13,27 @@ from numpy import any # to work in python 2.4
import
warnings
from
theano
import
gof
def
function_dump
(
filename
,
inputs
,
outputs
=
None
,
mode
=
None
,
updates
=
None
,
givens
=
None
,
no_default_updates
=
False
,
accept_inplace
=
False
,
name
=
None
,
rebuild_strict
=
True
,
allow_input_downcast
=
None
,
profile
=
None
,
on_unused_input
=
None
):
"""This is helpful to make a reproducable case for problem during
Theano compilation.
"""
assert
isinstance
(
filename
,
basestring
)
d
=
dict
(
inputs
=
inputs
,
outputs
=
outputs
,
mode
=
mode
,
updates
=
updates
,
givens
=
givens
,
no_default_updates
=
no_default_updates
,
accept_inplace
=
accept_inplace
,
name
=
name
,
rebuild_strict
=
rebuild_strict
,
allow_input_downcast
=
allow_input_downcast
,
profile
=
profile
,
on_unused_input
=
on_unused_input
)
with
open
(
filename
,
'wb'
)
as
f
:
cPickle
.
dump
(
d
,
f
,
-
1
)
def
function
(
inputs
,
outputs
=
None
,
mode
=
None
,
updates
=
None
,
givens
=
None
,
no_default_updates
=
False
,
accept_inplace
=
False
,
name
=
None
,
rebuild_strict
=
True
,
allow_input_downcast
=
None
,
profile
=
None
,
...
...
theano/compile/tests/test_function.py
0 → 100644
浏览文件 @
91a00e6f
import
cPickle
import
os
import
shutil
import
tempfile
import
numpy
import
theano
def
test_function_dump
():
v
=
theano
.
tensor
.
vector
()
fct1
=
theano
.
function
([
v
],
v
+
1
)
try
:
tmpdir
=
tempfile
.
mkdtemp
()
fname
=
os
.
path
.
join
(
tmpdir
,
'test_function_dump.pkl'
)
theano
.
function_dump
(
fname
,
[
v
],
v
+
1
)
f
=
open
(
fname
,
'rb'
)
l
=
cPickle
.
load
(
f
)
f
.
close
()
finally
:
if
tmpdir
is
not
None
:
shutil
.
rmtree
(
tmpdir
)
fct2
=
theano
.
function
(
**
l
)
x
=
[
1
,
2
,
3
]
assert
numpy
.
allclose
(
fct1
(
x
),
fct2
(
x
))
theano/gof/cutils.py
浏览文件 @
91a00e6f
import
errno
import
os
import
sys
...
...
@@ -248,7 +249,11 @@ fail:
loc
=
os
.
path
.
join
(
config
.
compiledir
,
'cutils_ext'
)
if
not
os
.
path
.
exists
(
loc
):
os
.
mkdir
(
loc
)
try
:
os
.
mkdir
(
loc
)
except
OSError
,
e
:
assert
e
.
errno
==
errno
.
EEXIST
assert
os
.
path
.
exists
(
loc
),
loc
args
=
cmodule
.
GCC_compiler
.
compile_args
()
cmodule
.
GCC_compiler
.
compile_str
(
'cutils_ext'
,
code
,
location
=
loc
,
...
...
@@ -264,7 +269,11 @@ try:
sys
.
path
.
insert
(
0
,
config
.
compiledir
)
location
=
os
.
path
.
join
(
config
.
compiledir
,
'cutils_ext'
)
if
not
os
.
path
.
exists
(
location
):
os
.
mkdir
(
location
)
try
:
os
.
mkdir
(
location
)
except
OSError
,
e
:
assert
e
.
errno
==
errno
.
EEXIST
assert
os
.
path
.
exists
(
location
),
location
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
location
,
'__init__.py'
)):
open
(
os
.
path
.
join
(
location
,
'__init__.py'
),
'w'
)
.
close
()
...
...
theano/gof/lazylinker_c.py
浏览文件 @
91a00e6f
...
...
@@ -80,7 +80,12 @@ except ImportError:
code
=
open
(
cfile
)
.
read
()
loc
=
os
.
path
.
join
(
config
.
compiledir
,
dirname
)
if
not
os
.
path
.
exists
(
loc
):
os
.
mkdir
(
loc
)
try
:
os
.
mkdir
(
loc
)
except
OSError
,
e
:
assert
e
.
errno
==
errno
.
EEXIST
assert
os
.
path
.
exists
(
loc
)
args
=
cmodule
.
GCC_compiler
.
compile_args
()
cmodule
.
GCC_compiler
.
compile_str
(
dirname
,
code
,
location
=
loc
,
preargs
=
args
)
...
...
theano/gof/vm.py
浏览文件 @
91a00e6f
...
...
@@ -410,6 +410,9 @@ class Stack(VM):
if
(
getattr
(
o
[
0
],
'flags'
,
False
)
and
o
[
0
]
.
flags
.
c_contiguous
):
st
=
'c'
elif
(
hasattr
(
data
[
0
],
'is_c_contiguous'
)
and
data
[
0
]
.
is_c_contiguous
()):
st
=
"c"
self
.
variable_strides
[
var
]
=
st
except
Exception
:
raise_with_op
(
current_apply
,
...
...
@@ -507,6 +510,9 @@ class Stack(VM):
if
(
getattr
(
o
[
0
],
'flags'
,
False
)
and
o
[
0
]
.
flags
.
c_contiguous
):
st
=
'c'
elif
(
hasattr
(
data
[
0
],
'is_c_contiguous'
)
and
data
[
0
]
.
is_c_contiguous
()):
st
=
"c"
self
.
variable_strides
[
var
]
=
st
input_index
=
[]
...
...
theano/scan_module/scan_perform_ext.py
浏览文件 @
91a00e6f
import
errno
import
logging
import
os
import
sys
...
...
@@ -61,7 +62,12 @@ except ImportError:
code
=
open
(
cfile
)
.
read
()
loc
=
os
.
path
.
join
(
config
.
compiledir
,
dirname
)
if
not
os
.
path
.
exists
(
loc
):
os
.
mkdir
(
loc
)
try
:
os
.
mkdir
(
loc
)
except
OSError
,
e
:
assert
e
.
errno
==
errno
.
EEXIST
assert
os
.
path
.
exists
(
loc
)
preargs
=
[
'-fwrapv'
,
'-O2'
,
'-fno-strict-aliasing'
]
preargs
+=
cmodule
.
GCC_compiler
.
compile_args
()
# Cython 19.1 always use the old NumPy interface. So we
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论