Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c0cca58a
提交
c0cca58a
authored
1月 11, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename GpuCAReduce to GpuCAReduceCPY
上级
440255b0
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
12 行增加
和
11 行删除
+12
-11
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+4
-4
opt.py
theano/sandbox/gpuarray/opt.py
+2
-2
test_elemwise.py
theano/sandbox/gpuarray/tests/test_elemwise.py
+4
-3
test_opt.py
theano/sandbox/gpuarray/tests/test_opt.py
+2
-2
没有找到文件。
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
c0cca58a
...
...
@@ -518,7 +518,7 @@ class GpuDimShuffle(HideC, DimShuffle):
return
(
3
,)
class
GpuCAReduce
(
GpuKernelBase
,
HideC
,
CAReduceDtype
):
class
GpuCAReduce
CPY
(
GpuKernelBase
,
HideC
,
CAReduceDtype
):
def
__init__
(
self
,
scalar_op
,
axis
=
None
,
dtype
=
None
,
acc_dtype
=
None
):
if
not
hasattr
(
scalar_op
,
'identity'
):
raise
ValueError
(
"No identity on scalar op"
)
...
...
@@ -550,7 +550,7 @@ class GpuCAReduce(GpuKernelBase, HideC, CAReduceDtype):
def
make_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
):
# cache the kernel object
self
.
get_kernel_cache
(
node
)
return
super
(
GpuCAReduce
,
self
)
.
make_thunk
(
node
,
storage_map
,
return
super
(
GpuCAReduce
CPY
,
self
)
.
make_thunk
(
node
,
storage_map
,
compute_map
,
no_recycling
)
def
get_kernel_cache
(
self
,
node
):
...
...
@@ -732,7 +732,7 @@ class GpuCAReduce(GpuKernelBase, HideC, CAReduceDtype):
err = GpuKernel_call(&
%(k_var)
s, 0,
%(ls)
s, gs, args);
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError,
"compyte error: GpuCAReduce:
%%
s.",
"compyte error: GpuCAReduce
CPY
:
%%
s.",
GpuKernel_error(&
%(k_var)
s, err));
%(fail)
s
}
...
...
@@ -741,7 +741,7 @@ class GpuCAReduce(GpuKernelBase, HideC, CAReduceDtype):
err = GpuArray_move(&
%(output)
s->ga, &tmp->ga);
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError,
"compyte error: GpuCAReduce [cast]:
%%
s.",
"compyte error: GpuCAReduce
CPY
[cast]:
%%
s.",
GpuArray_error(&tmp->ga, err));
%(fail)
s
}
...
...
theano/sandbox/gpuarray/opt.py
浏览文件 @
c0cca58a
...
...
@@ -24,7 +24,7 @@ from theano.sandbox.gpuarray.conv import GpuConv
from
theano.sandbox.gpuarray.nnet
import
(
GpuCrossentropySoftmaxArgmax1HotWithBias
,
GpuCrossentropySoftmax1HotWithBiasDx
)
from
theano.sandbox.gpuarray.elemwise
import
(
GpuElemwise
,
_is_scalar
,
GpuDimShuffle
,
GpuCAReduce
)
GpuDimShuffle
,
GpuCAReduce
CPY
)
from
theano.sandbox.gpuarray.subtensor
import
GpuIncSubtensor
,
GpuSubtensor
from
theano.sandbox.gpuarray.type
import
GpuArrayConstant
...
...
@@ -249,7 +249,7 @@ def local_gpua_incsubtensor(node):
def
local_gpua_careduce
(
node
):
if
(
isinstance
(
node
.
op
.
scalar_op
,
scalar
.
basic
.
Add
)
or
isinstance
(
node
.
op
.
scalar_op
,
scalar
.
basic
.
Mul
)):
return
GpuCAReduce
(
node
.
op
.
scalar_op
,
axis
=
node
.
op
.
axis
,
return
GpuCAReduce
CPY
(
node
.
op
.
scalar_op
,
axis
=
node
.
op
.
axis
,
dtype
=
getattr
(
node
.
op
,
'dtype'
,
None
),
acc_dtype
=
getattr
(
node
.
op
,
'acc_dtype'
,
None
))
...
...
theano/sandbox/gpuarray/tests/test_elemwise.py
浏览文件 @
c0cca58a
...
...
@@ -10,7 +10,7 @@ from theano.tensor.tests.test_elemwise import (test_Broadcast, test_DimShuffle,
from
theano.sandbox.gpuarray.tests.test_basic_ops
import
rand_gpuarray
from
theano.sandbox.gpuarray.elemwise
import
(
GpuElemwise
,
GpuDimShuffle
,
GpuCAReduce
)
GpuCAReduce
CPY
)
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
pygpu.array
import
gpuarray
...
...
@@ -37,10 +37,11 @@ class test_gpu_Broadcast(test_Broadcast):
class
test_GpuDimShuffle
(
test_DimShuffle
):
op
=
GpuDimShuffle
class
test_GpuCAReduce
(
test_CAReduce
):
class
test_GpuCAReduceCPY
(
test_CAReduce
):
dtypes
=
[
"float32"
]
bin_dtypes
=
[
"uint8"
,
"int8"
]
op
=
GpuCAReduce
op
=
GpuCAReduce
CPY
reds
=
[
scalar
.
add
,
scalar
.
mul
]
def
test_perform
(
self
):
...
...
theano/sandbox/gpuarray/tests/test_opt.py
浏览文件 @
c0cca58a
...
...
@@ -3,7 +3,7 @@ import numpy
import
theano
from
theano.tests
import
unittest_tools
as
utt
from
theano.sandbox.gpuarray.basic_ops
import
GpuAlloc
,
GpuReshape
,
gpu_alloc
from
theano.sandbox.gpuarray.elemwise
import
GpuCAReduce
from
theano.sandbox.gpuarray.elemwise
import
GpuCAReduce
CPY
import
theano.sandbox.gpuarray
from
theano.tests.unittest_tools
import
SkipTest
...
...
@@ -69,7 +69,7 @@ def test_sum_prod():
res
=
f
(
val
)
utt
.
assert_allclose
(
res
,
val
.
sum
())
assert
res
.
shape
==
()
assert
GpuCAReduce
in
[
type
(
node
.
op
)
assert
GpuCAReduce
CPY
in
[
type
(
node
.
op
)
for
node
in
f
.
maker
.
fgraph
.
toposort
()]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论