Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1b530f72
提交
1b530f72
authored
4月 19, 2016
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Small test fix
上级
68bb6a7b
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
5 行增加
和
8 行删除
+5
-8
test_multinomial.py
theano/sandbox/gpuarray/tests/test_multinomial.py
+5
-8
没有找到文件。
theano/sandbox/gpuarray/tests/test_multinomial.py
浏览文件 @
1b530f72
...
@@ -9,7 +9,7 @@ from theano import config, function, tensor
...
@@ -9,7 +9,7 @@ from theano import config, function, tensor
from
..multinomial
import
GPUAMultinomialFromUniform
from
..multinomial
import
GPUAMultinomialFromUniform
from
theano.compile.mode
import
get_default_mode
,
predefined_linkers
from
theano.compile.mode
import
get_default_mode
,
predefined_linkers
import
theano.tests.unittest_tools
as
utt
import
theano.tests.unittest_tools
as
utt
from
.
.
import
pygpu_activated
from
.
config
import
mode_with_gpu
,
mode_without_gpu
,
test_ctx_name
def
get_mode
(
gpu
):
def
get_mode
(
gpu
):
...
@@ -66,9 +66,9 @@ def test_multinomial_0():
...
@@ -66,9 +66,9 @@ def test_multinomial_0():
utt
.
assert_allclose
(
r
,
[[
0
,
2
]])
utt
.
assert_allclose
(
r
,
[[
0
,
2
]])
run_with_c
(
body
)
run_with_c
(
body
)
if
pygpu_activated
:
run_with_c
(
body
,
True
)
run_with_c
(
body
,
True
)
# TODO: check a bigger example (make sure blocking on GPU is handled correctly)
# TODO: check a bigger example (make sure blocking on GPU is handled correctly)
def
test_multinomial_large
():
def
test_multinomial_large
():
# DEBUG_MODE will test this on GPU
# DEBUG_MODE will test this on GPU
...
@@ -81,7 +81,8 @@ def test_multinomial_large():
...
@@ -81,7 +81,8 @@ def test_multinomial_large():
assert
any
([
type
(
node
.
op
)
is
GPUAMultinomialFromUniform
assert
any
([
type
(
node
.
op
)
is
GPUAMultinomialFromUniform
for
node
in
f
.
maker
.
fgraph
.
toposort
()])
for
node
in
f
.
maker
.
fgraph
.
toposort
()])
pval
=
numpy
.
arange
(
10000
*
4
,
dtype
=
'float32'
)
.
reshape
((
10000
,
4
))
+
0.1
pval
=
numpy
.
arange
(
10000
*
4
,
dtype
=
'float32'
)
.
reshape
((
10000
,
4
))
+
0.1
pval
=
pval
/
pval
.
sum
(
axis
=
1
)[:,
None
]
pval
=
pval
/
pval
.
sum
(
axis
=
1
)[:,
None
]
uval
=
numpy
.
ones_like
(
pval
[:,
0
])
*
0.5
uval
=
numpy
.
ones_like
(
pval
[:,
0
])
*
0.5
mval
=
f
(
pval
,
uval
)
mval
=
f
(
pval
,
uval
)
...
@@ -99,15 +100,11 @@ def test_multinomial_large():
...
@@ -99,15 +100,11 @@ def test_multinomial_large():
asdf
=
numpy
.
asarray
([
0
,
0
,
2
,
0
])
+
0
*
pval
asdf
=
numpy
.
asarray
([
0
,
0
,
2
,
0
])
+
0
*
pval
utt
.
assert_allclose
(
mval
,
asdf
)
# broadcast over all rows
utt
.
assert_allclose
(
mval
,
asdf
)
# broadcast over all rows
run_with_c
(
body
)
run_with_c
(
body
)
if
pygpu_activated
:
run_with_c
(
body
,
True
)
run_with_c
(
body
,
True
)
def
test_gpu_opt
():
def
test_gpu_opt
():
# Does have some overlap with test_multinomial_0
# Does have some overlap with test_multinomial_0
if
not
pygpu_activated
:
# Skip test if cuda_ndarray is not available.
from
nose.plugins.skip
import
SkipTest
raise
SkipTest
(
'Optional package gpu array not activated'
)
# We test the case where we put the op on the gpu when the output
# We test the case where we put the op on the gpu when the output
# is moved to the gpu.
# is moved to the gpu.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论