Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9c57a03c
提交
9c57a03c
authored
4月 12, 2016
作者:
texot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix PersistentNdarrayLoad problem restoring same object twice
上级
1efb1539
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
4 行删除
+10
-4
sharedvalue.py
theano/compile/sharedvalue.py
+1
-1
pkl_utils.py
theano/misc/pkl_utils.py
+9
-3
没有找到文件。
theano/compile/sharedvalue.py
浏览文件 @
9c57a03c
...
@@ -76,7 +76,7 @@ class SharedVariable(Variable):
...
@@ -76,7 +76,7 @@ class SharedVariable(Variable):
raise
TypeError
(
'value and strict are ignored if you pass '
raise
TypeError
(
'value and strict are ignored if you pass '
'a container here'
)
'a container here'
)
else
:
else
:
if
container
is
not
None
:
if
value
is
not
None
:
raise
TypeError
(
'Error to specify both value and container'
)
raise
TypeError
(
'Error to specify both value and container'
)
self
.
container
=
Container
(
self
.
container
=
Container
(
self
,
self
,
...
...
theano/misc/pkl_utils.py
浏览文件 @
9c57a03c
...
@@ -275,10 +275,14 @@ class PersistentNdarrayLoad(object):
...
@@ -275,10 +275,14 @@ class PersistentNdarrayLoad(object):
"""
"""
def
__init__
(
self
,
zip_file
):
def
__init__
(
self
,
zip_file
):
self
.
zip_file
=
zip_file
self
.
zip_file
=
zip_file
self
.
cache
=
{}
def
__call__
(
self
,
persid
):
def
__call__
(
self
,
persid
):
array_type
,
name
=
persid
.
split
(
'.'
)
array_type
,
name
=
persid
.
split
(
'.'
)
if
name
in
self
.
cache
:
return
self
.
cache
[
name
]
ret
=
None
array
=
numpy
.
lib
.
format
.
read_array
(
self
.
zip_file
.
open
(
name
))
array
=
numpy
.
lib
.
format
.
read_array
(
self
.
zip_file
.
open
(
name
))
if
array_type
==
'cuda_ndarray'
:
if
array_type
==
'cuda_ndarray'
:
if
config
.
experimental
.
unpickle_gpu_on_cpu
:
if
config
.
experimental
.
unpickle_gpu_on_cpu
:
...
@@ -286,14 +290,16 @@ class PersistentNdarrayLoad(object):
...
@@ -286,14 +290,16 @@ class PersistentNdarrayLoad(object):
warnings
.
warn
(
"config.experimental.unpickle_gpu_on_cpu is set "
warnings
.
warn
(
"config.experimental.unpickle_gpu_on_cpu is set "
"to True. Unpickling CudaNdarray as "
"to True. Unpickling CudaNdarray as "
"numpy.ndarray"
)
"numpy.ndarray"
)
ret
urn
array
ret
=
array
elif
cuda_ndarray
:
elif
cuda_ndarray
:
ret
urn
cuda_ndarray
.
cuda_ndarray
.
CudaNdarray
(
array
)
ret
=
cuda_ndarray
.
cuda_ndarray
.
CudaNdarray
(
array
)
else
:
else
:
raise
ImportError
(
"Cuda not found. Cannot unpickle "
raise
ImportError
(
"Cuda not found. Cannot unpickle "
"CudaNdarray"
)
"CudaNdarray"
)
else
:
else
:
return
array
ret
=
array
self
.
cache
[
name
]
=
ret
return
ret
def
dump
(
obj
,
file_handler
,
protocol
=
DEFAULT_PROTOCOL
,
def
dump
(
obj
,
file_handler
,
protocol
=
DEFAULT_PROTOCOL
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论