Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
acd4da11
提交
acd4da11
authored
4月 27, 2015
作者:
dima
提交者:
serdyuk
4月 29, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Test names in a zip file produced by dump
上级
9cdbcdb4
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
3 行删除
+22
-3
test_pkl_utils.py
theano/misc/tests/test_pkl_utils.py
+22
-3
没有找到文件。
theano/misc/tests/test_pkl_utils.py
浏览文件 @
acd4da11
import
numpy
from
numpy.testing
import
assert_allclose
from
numpy.testing
import
assert_allclose
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
import
theano
import
theano.sandbox.cuda
as
cuda_ndarray
import
theano.sandbox.cuda
as
cuda_ndarray
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda.type
import
CudaNdarrayType
...
@@ -8,11 +10,11 @@ from theano.sandbox.cuda.var import CudaNdarraySharedVariable
...
@@ -8,11 +10,11 @@ from theano.sandbox.cuda.var import CudaNdarraySharedVariable
from
theano.sandbox.rng_mrg
import
MRG_RandomStreams
from
theano.sandbox.rng_mrg
import
MRG_RandomStreams
from
theano.misc.pkl_utils
import
dump
,
load
from
theano.misc.pkl_utils
import
dump
,
load
if
not
cuda_ndarray
.
cuda_enabled
:
raise
SkipTest
(
'Optional package cuda disabled'
)
def
test_dump_load
():
def
test_dump_load
():
if
not
cuda_ndarray
.
cuda_enabled
:
raise
SkipTest
(
'Optional package cuda disabled'
)
x
=
CudaNdarraySharedVariable
(
'x'
,
CudaNdarrayType
((
1
,
1
),
name
=
'x'
),
x
=
CudaNdarraySharedVariable
(
'x'
,
CudaNdarrayType
((
1
,
1
),
name
=
'x'
),
[[
1
]],
False
)
[[
1
]],
False
)
...
@@ -27,6 +29,9 @@ def test_dump_load():
...
@@ -27,6 +29,9 @@ def test_dump_load():
def
test_dump_load_mrg
():
def
test_dump_load_mrg
():
if
not
cuda_ndarray
.
cuda_enabled
:
raise
SkipTest
(
'Optional package cuda disabled'
)
rng
=
MRG_RandomStreams
(
use_cuda
=
True
)
rng
=
MRG_RandomStreams
(
use_cuda
=
True
)
with
open
(
'test'
,
'w'
)
as
f
:
with
open
(
'test'
,
'w'
)
as
f
:
...
@@ -36,3 +41,17 @@ def test_dump_load_mrg():
...
@@ -36,3 +41,17 @@ def test_dump_load_mrg():
rng
=
load
(
f
)
rng
=
load
(
f
)
assert
type
(
rng
)
==
MRG_RandomStreams
assert
type
(
rng
)
==
MRG_RandomStreams
def
test_dump_zip_names
():
foo_1
=
theano
.
shared
(
0
,
name
=
'foo'
)
foo_2
=
theano
.
shared
(
1
,
name
=
'foo'
)
with
open
(
'model.zip'
,
'w'
)
as
f
:
dump
((
foo_1
,
foo_2
,
numpy
.
array
(
2
)),
f
)
keys
=
numpy
.
load
(
'model.zip'
)
.
keys
()
assert
keys
==
[
'foo'
,
'foo_2'
,
'array_0'
,
'pkl'
]
foo
=
numpy
.
load
(
'model.zip'
)[
'foo'
]
assert
foo
==
numpy
.
array
(
0
)
with
open
(
'model.zip'
)
as
f
:
foo_1
,
foo_2
,
array
=
load
(
f
)
assert
array
==
numpy
.
array
(
2
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论