Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0dc3913f
提交
0dc3913f
authored
2月 16, 2017
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a test that make GpuElemwise compilation crash
上级
8757c2dc
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
46 行增加
和
0 行删除
+46
-0
test_basic_ops.py
theano/gpuarray/tests/test_basic_ops.py
+46
-0
没有找到文件。
theano/gpuarray/tests/test_basic_ops.py
浏览文件 @
0dc3913f
...
@@ -474,3 +474,49 @@ def test_Gpujoin_inplace():
...
@@ -474,3 +474,49 @@ def test_Gpujoin_inplace():
f
=
theano
.
function
([
s
],
theano
.
Out
(
c
,
borrow
=
True
))
f
=
theano
.
function
([
s
],
theano
.
Out
(
c
,
borrow
=
True
))
assert
x
.
get_value
(
borrow
=
True
,
return_internal_type
=
True
)
is
f
(
0
)
assert
x
.
get_value
(
borrow
=
True
,
return_internal_type
=
True
)
is
f
(
0
)
assert
np
.
allclose
(
f
(
0
),
[
3
,
4
,
5
])
assert
np
.
allclose
(
f
(
0
),
[
3
,
4
,
5
])
def
test_many_arg_elemwise
():
"""this test checks whether the + and * elemwise ops can handle extremely large numbers of
arguments on gpu
i.e., it is a test of the optimization theano/sandbox/cuda/opt.py:local_gpu_huge_add_or_mul """
rng
=
np
.
random
.
RandomState
([
1
,
2
,
3
])
for
num_args
in
[
25
,
125
]:
for
op_to_test
in
[
theano
.
tensor
.
add
,
theano
.
tensor
.
mul
]:
for
nb_dim
in
[
2
,
3
,
4
,
5
]:
shapes
=
[
rng
.
randint
(
1
,
5
)
for
i
in
range
(
nb_dim
)]
args
=
[
np
.
cast
[
'float32'
](
rng
.
randn
(
*
shapes
))
for
arg
in
xrange
(
0
,
num_args
)]
symb_args
=
[
theano
.
tensor
.
TensorType
(
'float32'
,
(
False
,)
*
nb_dim
)()
for
arg
in
xrange
(
0
,
num_args
)]
outputs
=
[]
for
mode
in
[
mode_with_gpu
,
mode_without_gpu
]:
# test the optijmization local_gpu_elemwise_0
f
=
theano
.
function
(
symb_args
,
op_to_test
(
*
symb_args
),
mode
=
mode
.
excluding
(
"local_gpu_elemwise_1"
))
outputs
.
append
(
f
(
*
args
))
# assert that the test was done on the gpu.
if
mode
is
mode_with_gpu
:
assert
any
([
isinstance
(
node
.
op
,
GpuElemwise
)
for
node
in
f
.
maker
.
fgraph
.
apply_nodes
])
# test the optijmization local_gpu_elemwise_1
f
=
theano
.
function
(
symb_args
,
GpuFromHost
(
test_ctx_name
)(
op_to_test
(
*
symb_args
)),
mode
=
mode
.
excluding
(
"local_gpu_elemwise_0"
))
out
=
f
(
*
args
)
# assert that the test was done on the gpu.
if
mode
is
mode_with_gpu
:
assert
any
([
isinstance
(
node
.
op
,
GpuElemwise
)
for
node
in
f
.
maker
.
fgraph
.
apply_nodes
])
utt
.
assert_allclose
(
out
,
outputs
[
-
1
])
results_gpu
,
results_cpu
=
outputs
utt
.
assert_allclose
(
results_gpu
,
results_cpu
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论