提交 c0cca58a authored 作者: Frederic's avatar Frederic

Rename GpuCAReduce to GpuCAReduceCPY

上级 440255b0
......@@ -518,7 +518,7 @@ class GpuDimShuffle(HideC, DimShuffle):
return (3,)
class GpuCAReduce(GpuKernelBase, HideC, CAReduceDtype):
class GpuCAReduceCPY(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(GpuCAReduceCPY, 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: GpuCAReduceCPY: %%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: GpuCAReduceCPY [cast]: %%s.",
GpuArray_error(&tmp->ga, err));
%(fail)s
}
......
......@@ -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, GpuCAReduceCPY)
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 GpuCAReduceCPY(node.op.scalar_op, axis=node.op.axis,
dtype=getattr(node.op, 'dtype', None),
acc_dtype=getattr(node.op, 'acc_dtype', None))
......
......@@ -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)
GpuCAReduceCPY)
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 = GpuCAReduceCPY
reds = [scalar.add, scalar.mul]
def test_perform(self):
......
......@@ -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 GpuCAReduceCPY
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 GpuCAReduceCPY in [type(node.op)
for node in f.maker.fgraph.toposort()]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论