Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
33fae103
提交
33fae103
authored
9月 27, 2013
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a test for GpuCAReduce
上级
955248cc
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
4 行删除
+31
-4
test_elemwise.py
theano/sandbox/gpuarray/tests/test_elemwise.py
+29
-3
test_elemwise.py
theano/tensor/tests/test_elemwise.py
+2
-1
没有找到文件。
theano/sandbox/gpuarray/tests/test_elemwise.py
浏览文件 @
33fae103
import
unittest
import
unittest
from
theano
import
scalar
from
theano
import
scalar
,
gof
from
theano.gof
import
FunctionGraph
from
theano.gof
import
FunctionGraph
from
theano.gof.python25
import
all
,
any
from
theano.gof.python25
import
all
,
any
from
theano.tests.unittest_tools
import
SkipTest
from
theano.tensor.tests.test_elemwise
import
test_Broadcast
,
test_DimShuffle
from
theano.tensor.tests.test_elemwise
import
(
test_Broadcast
,
test_DimShuffle
,
test_CAReduce
)
from
theano.sandbox.gpuarray.tests.test_basic_ops
import
rand_gpuarray
from
theano.sandbox.gpuarray.tests.test_basic_ops
import
rand_gpuarray
from
theano.sandbox.gpuarray.elemwise
import
GpuElemwise
,
GpuDimShuffle
from
theano.sandbox.gpuarray.elemwise
import
(
GpuElemwise
,
GpuDimShuffle
,
GpuCAReduce
)
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
pygpu.array
import
gpuarray
from
pygpu.array
import
gpuarray
...
@@ -30,3 +33,26 @@ class test_gpu_Broadcast(test_Broadcast):
...
@@ -30,3 +33,26 @@ class test_gpu_Broadcast(test_Broadcast):
class
test_GpuDimShuffle
(
test_DimShuffle
):
class
test_GpuDimShuffle
(
test_DimShuffle
):
op
=
GpuDimShuffle
op
=
GpuDimShuffle
class
test_GpuCAReduce
(
test_CAReduce
):
dtypes
=
[
"float32"
]
op
=
GpuCAReduce
reds
=
[
scalar
.
add
,
scalar
.
mul
]
def
test_perform
(
self
):
for
dtype
in
self
.
dtypes
+
self
.
bin_dtypes
:
for
op
in
self
.
reds
:
self
.
with_linker
(
gof
.
PerformLinker
(),
op
,
dtype
=
dtype
)
def
test_perform_nan
(
self
):
raise
SkipTest
(
"for now"
)
for
dtype
in
self
.
dtypes
:
for
op
in
self
.
reds
:
self
.
with_linker
(
gof
.
PerformLinker
(),
op
,
dtype
=
dtype
,
test_nan
=
True
)
def
test_c
(
self
):
raise
SkipTest
(
"no C code"
)
def
test_c_nan
(
self
):
raise
SkipTest
(
"no C code"
)
theano/tensor/tests/test_elemwise.py
浏览文件 @
33fae103
...
@@ -283,6 +283,7 @@ class test_Broadcast(unittest.TestCase):
...
@@ -283,6 +283,7 @@ class test_Broadcast(unittest.TestCase):
class
test_CAReduce
(
unittest_tools
.
InferShapeTester
):
class
test_CAReduce
(
unittest_tools
.
InferShapeTester
):
op
=
CAReduce
def
with_linker
(
self
,
linker
,
scalar_op
=
scalar
.
add
,
dtype
=
"floatX"
,
def
with_linker
(
self
,
linker
,
scalar_op
=
scalar
.
add
,
dtype
=
"floatX"
,
test_nan
=
False
,
tensor_op
=
None
):
test_nan
=
False
,
tensor_op
=
None
):
...
@@ -305,7 +306,7 @@ class test_CAReduce(unittest_tools.InferShapeTester):
...
@@ -305,7 +306,7 @@ class test_CAReduce(unittest_tools.InferShapeTester):
dtype
=
theano
.
config
.
floatX
dtype
=
theano
.
config
.
floatX
x
=
TensorType
(
dtype
,
[(
entry
==
1
)
for
entry
in
xsh
])(
'x'
)
x
=
TensorType
(
dtype
,
[(
entry
==
1
)
for
entry
in
xsh
])(
'x'
)
if
tensor_op
is
None
:
if
tensor_op
is
None
:
e
=
CAReduce
(
scalar_op
,
axis
=
tosum
)(
x
)
e
=
self
.
op
(
scalar_op
,
axis
=
tosum
)(
x
)
else
:
else
:
e
=
tensor_op
(
x
,
axis
=
tosum
)
e
=
tensor_op
(
x
,
axis
=
tosum
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论