Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6bf3539c
提交
6bf3539c
authored
2月 03, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1718 from nouiz/pickle_eval
Fix crash during unpickling of Theano variable
上级
916f3b55
ada05f52
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
20 行增加
和
1 行删除
+20
-1
function_module.py
theano/compile/function_module.py
+5
-0
configdefaults.py
theano/configdefaults.py
+7
-0
graph.py
theano/gof/graph.py
+4
-0
test_graph.py
theano/gof/tests/test_graph.py
+4
-1
没有找到文件。
theano/compile/function_module.py
浏览文件 @
6bf3539c
...
@@ -709,6 +709,8 @@ def _pickle_Function(f):
...
@@ -709,6 +709,8 @@ def _pickle_Function(f):
return
rval
return
rval
def
_constructor_Function
(
maker
,
input_storage
,
inputs_data
):
def
_constructor_Function
(
maker
,
input_storage
,
inputs_data
):
if
not
theano
.
config
.
unpickle_function
:
return
None
f
=
maker
.
create
(
input_storage
,
trustme
=
True
)
f
=
maker
.
create
(
input_storage
,
trustme
=
True
)
assert
len
(
f
.
input_storage
)
==
len
(
inputs_data
)
assert
len
(
f
.
input_storage
)
==
len
(
inputs_data
)
for
container
,
x
in
zip
(
f
.
input_storage
,
inputs_data
):
for
container
,
x
in
zip
(
f
.
input_storage
,
inputs_data
):
...
@@ -1204,7 +1206,10 @@ def _pickle_FunctionMaker(self):
...
@@ -1204,7 +1206,10 @@ def _pickle_FunctionMaker(self):
def
_constructor_FunctionMaker
(
kwargs
):
def
_constructor_FunctionMaker
(
kwargs
):
if
theano
.
config
.
unpickle_function
:
return
FunctionMaker
(
**
kwargs
)
return
FunctionMaker
(
**
kwargs
)
else
:
return
None
copy_reg
.
pickle
(
FunctionMaker
,
_pickle_FunctionMaker
)
copy_reg
.
pickle
(
FunctionMaker
,
_pickle_FunctionMaker
)
...
...
theano/configdefaults.py
浏览文件 @
6bf3539c
...
@@ -410,6 +410,13 @@ AddConfigVar('compute_test_value_opt',
...
@@ -410,6 +410,13 @@ AddConfigVar('compute_test_value_opt',
EnumStr
(
'off'
,
'ignore'
,
'warn'
,
'raise'
,
'pdb'
),
EnumStr
(
'off'
,
'ignore'
,
'warn'
,
'raise'
,
'pdb'
),
in_c_key
=
False
)
in_c_key
=
False
)
AddConfigVar
(
'unpickle_function'
,
(
"Replace unpickled Theano function with None"
,
"This is useful to unpickle old graph that pickled"
" them when it shouldn't"
),
BoolParam
(
True
),
in_c_key
=
False
)
"""Note to developers:
"""Note to developers:
Generally your exceptions should use an apply node's __str__
Generally your exceptions should use an apply node's __str__
method when exception_verbosity == 'low'. When exception_verbosity
method when exception_verbosity == 'low'. When exception_verbosity
...
...
theano/gof/graph.py
浏览文件 @
6bf3539c
...
@@ -424,6 +424,10 @@ class Variable(Node):
...
@@ -424,6 +424,10 @@ class Variable(Node):
return
rval
return
rval
def
__getstate__
(
self
):
d
=
self
.
__dict__
.
copy
()
d
.
pop
(
"_fn"
,
None
)
return
d
env
=
property
(
env_getter
,
env_setter
,
env_deleter
)
env
=
property
(
env_getter
,
env_setter
,
env_deleter
)
...
...
theano/gof/tests/test_graph.py
浏览文件 @
6bf3539c
import
pickle
import
unittest
import
unittest
from
theano
import
tensor
from
theano
import
tensor
...
@@ -292,7 +293,6 @@ class TestIsSameGraph(unittest.TestCase):
...
@@ -292,7 +293,6 @@ class TestIsSameGraph(unittest.TestCase):
debug
=
False
)
debug
=
False
)
################
################
# eval #
# eval #
################
################
...
@@ -305,3 +305,6 @@ def test_eval():
...
@@ -305,3 +305,6 @@ def test_eval():
result
=
z
.
eval
({
x
:
1.
,
y
:
2.
})
result
=
z
.
eval
({
x
:
1.
,
y
:
2.
})
assert
result
==
3.
assert
result
==
3.
# We don't want to pickle the tmp function.
assert
not
hasattr
(
pickle
.
loads
(
pickle
.
dumps
(
z
)),
'_fn'
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论