Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0e5431a6
提交
0e5431a6
authored
4月 20, 2017
作者:
Faruk Ahmed
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
making sure we are testing a large-split
上级
324de62a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
6 行删除
+15
-6
test_opt.py
theano/gpuarray/tests/test_opt.py
+15
-6
没有找到文件。
theano/gpuarray/tests/test_opt.py
浏览文件 @
0e5431a6
...
@@ -15,7 +15,8 @@ from ..type import GpuArrayType, gpuarray_shared_constructor, get_context
...
@@ -15,7 +15,8 @@ from ..type import GpuArrayType, gpuarray_shared_constructor, get_context
from
..basic_ops
import
(
from
..basic_ops
import
(
GpuAlloc
,
GpuAllocEmpty
,
GpuReshape
,
GpuFromHost
,
host_from_gpu
)
GpuAlloc
,
GpuAllocEmpty
,
GpuReshape
,
GpuFromHost
,
host_from_gpu
)
from
..blas
import
GpuGemm
from
..blas
import
GpuGemm
from
..elemwise
import
GpuCAReduceCuda
,
GpuCAReduceCPY
,
GpuElemwise
,
Elemwise
from
..elemwise
import
(
GpuCAReduceCuda
,
GpuCAReduceCPY
,
GpuElemwise
,
Elemwise
,
max_inputs_to_GpuElemwise
)
from
..subtensor
import
GpuSubtensor
from
..subtensor
import
GpuSubtensor
from
..linalg
import
GpuCusolverSolve
,
cusolver_available
from
..linalg
import
GpuCusolverSolve
,
cusolver_available
...
@@ -454,10 +455,10 @@ def test_many_arg_elemwise():
...
@@ -454,10 +455,10 @@ def test_many_arg_elemwise():
# extremely large numbers of arguments on gpu.
# extremely large numbers of arguments on gpu.
rng
=
np
.
random
.
RandomState
([
1
,
2
,
3
])
rng
=
np
.
random
.
RandomState
([
1
,
2
,
3
])
nb_of_inputs_overflows
=
[]
for
num_args
in
[
32
,
64
,
128
]:
for
num_args
in
[
64
]:
for
op_to_test
in
[
theano
.
tensor
.
add
,
theano
.
tensor
.
mul
]:
for
op_to_test
in
[
theano
.
tensor
.
add
,
theano
.
tensor
.
mul
]:
for
nb_dim
in
[
2
,
4
,
8
]:
for
nb_dim
in
[
2
,
8
]:
shapes
=
[
rng
.
randint
(
1
,
int
(
32
/
nb_dim
))
for
i
in
range
(
nb_dim
)]
shapes
=
[
rng
.
randint
(
1
,
int
(
32
/
nb_dim
))
for
i
in
range
(
nb_dim
)]
args
=
[
np
.
cast
[
'float32'
](
rng
.
randn
(
*
shapes
))
args
=
[
np
.
cast
[
'float32'
](
rng
.
randn
(
*
shapes
))
for
arg
in
range
(
0
,
num_args
)]
for
arg
in
range
(
0
,
num_args
)]
...
@@ -469,12 +470,14 @@ def test_many_arg_elemwise():
...
@@ -469,12 +470,14 @@ def test_many_arg_elemwise():
outputs
=
[]
outputs
=
[]
for
mode
in
[
mode_with_gpu
,
mode_without_gpu
]:
for
mode
in
[
mode_with_gpu
,
mode_without_gpu
]:
# test the optimization local_gpua_elemwise
# test the optimization local_gpua_elemwise
f
=
theano
.
function
(
output
=
op_to_test
(
*
symb_args
)
symb_args
,
op_to_test
(
*
symb_args
)
)
f
=
theano
.
function
(
symb_args
,
output
)
outputs
.
append
(
f
(
*
args
))
outputs
.
append
(
f
(
*
args
))
# assert that the test was done on the gpu.
# assert that the test was done on the gpu.
if
mode
is
mode_with_gpu
:
if
mode
is
mode_with_gpu
:
nb_of_inputs_overflows
.
append
(
max_inputs_to_GpuElemwise
(
output
.
owner
)
-
num_args
)
nodelst
=
[
node
for
node
in
f
.
maker
.
fgraph
.
apply_nodes
]
nodelst
=
[
node
for
node
in
f
.
maker
.
fgraph
.
apply_nodes
]
assert
any
(
isinstance
(
node
.
op
,
GpuElemwise
)
assert
any
(
isinstance
(
node
.
op
,
GpuElemwise
)
for
node
in
nodelst
)
for
node
in
nodelst
)
...
@@ -484,6 +487,12 @@ def test_many_arg_elemwise():
...
@@ -484,6 +487,12 @@ def test_many_arg_elemwise():
results_gpu
,
results_cpu
=
outputs
results_gpu
,
results_cpu
=
outputs
utt
.
assert_allclose
(
results_gpu
,
results_cpu
)
utt
.
assert_allclose
(
results_gpu
,
results_cpu
)
# Make sure we test at least one case with no number of inputs overflow
assert
any
(
overflow
>=
0
for
overflow
in
nb_of_inputs_overflows
)
# Make sure we test at least one case with number of inputs overflow
assert
any
(
overflow
<
0
for
overflow
in
nb_of_inputs_overflows
)
def
test_not_useless_scalar_gpuelemwise
():
def
test_not_useless_scalar_gpuelemwise
():
# We don't want to move elemwise on scalar on the GPU when the
# We don't want to move elemwise on scalar on the GPU when the
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论