提交 da3df882 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #2896 from abergeron/fix_advsub

Fix crashes in the gpuarray test suite.
......@@ -835,7 +835,7 @@ class GpuJoin(HideC, Join):
node.outputs[0].dtype)
def c_code_cache_version(self):
return (1,)
return (2,)
def c_code(self, node, name, inputs, out_, sub):
copy_to_list = []
......@@ -851,9 +851,22 @@ if (als == NULL) {
}
%(copy_inputs_to_list)s
Py_XDECREF(%(out)s);
%(out)s = pygpu_concatenate(als, %(n)s, PyInt_AsLong((PyObject *)%(axis)s),
{
int axis = PyInt_AsLong((PyObject *)%(axis)s);
if (axis < 0) {
if (axis == -1 && PyErr_Occurred()) {
%(fail)s
}
axis += als[0]->nd;
if (axis < 0) {
PyErr_SetString(PyExc_IndexError, "invalid axis");
%(fail)s
}
}
%(out)s = pygpu_concatenate(als, %(n)s, axis,
%(restype)s, (PyObject *)&PyGpuArrayType,
pygpu_default_context());
}
PyMem_Free(als);
if (%(out)s == NULL)
%(fail)s
......
......@@ -302,7 +302,7 @@ GpuAllocTester = makeTester(
)
class TestAlloc(theano.tensor.tests.test_basic.TestAlloc):
class TestAlloc(test_basic.TestAlloc):
dtype = "float32"
mode = mode_with_gpu
shared = staticmethod(gpuarray_shared_constructor)
......
......@@ -29,13 +29,6 @@ from ..conv import GpuConv
import pygpu
gftensor4 = GpuArrayType('float32', [False] * 4)
device_id = theano.sandbox.cuda.use.device_number
# TODO do with with the new back-end.
from theano.sandbox.cuda import cuda_ndarray
cuda_ndarray = theano.sandbox.cuda.cuda_ndarray.cuda_ndarray
device_prop = cuda_ndarray.device_properties(device_id)
def py_conv_valid_numpy(img, kern):
assert img.shape[1] == kern.shape[1]
outshp = (img.shape[0], kern.shape[0],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论