提交 7fc26b8f authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Follow the rename in pygpu.

上级 306c8bc7
...@@ -222,7 +222,7 @@ class GpuDimShuffle(HideC, DimShuffle): ...@@ -222,7 +222,7 @@ class GpuDimShuffle(HideC, DimShuffle):
return """ return """
static const unsigned int %(name)s_ax[] = {%(shuffle)s}; static const unsigned int %(name)s_ax[] = {%(shuffle)s};
static int %(name)s_f(GpuArrayObject *res, GpuArrayObject *a) { static int %(name)s_f(PyGpuArrayObject *res, PyGpuArrayObject *a) {
GpuArray tmp; GpuArray tmp;
size_t sh[%(nd_out)s]; size_t sh[%(nd_out)s];
unsigned int i; unsigned int i;
...@@ -258,7 +258,7 @@ class GpuDimShuffle(HideC, DimShuffle): ...@@ -258,7 +258,7 @@ class GpuDimShuffle(HideC, DimShuffle):
} }
Py_XDECREF(%(out)s); Py_XDECREF(%(out)s);
%(out)s = new_GpuArray((PyObject *)&GpuArrayType, pygpu_default_context(), Py_None); %(out)s = new_GpuArray((PyObject *)&PyGpuArrayType, pygpu_default_context(), Py_None);
if (%(out)s == NULL) {%(fail)s} if (%(out)s == NULL) {%(fail)s}
if (%(name)s_f(%(out)s, %(inp)s)) { if (%(name)s_f(%(out)s, %(inp)s)) {
...@@ -272,12 +272,12 @@ class GpuDimShuffle(HideC, DimShuffle): ...@@ -272,12 +272,12 @@ class GpuDimShuffle(HideC, DimShuffle):
PyObject *%(name)s_tmp; PyObject *%(name)s_tmp;
%(name)s_tmp = PyObject_CallMethod((PyObject *)%(out)s, "copy", NULL); %(name)s_tmp = PyObject_CallMethod((PyObject *)%(out)s, "copy", NULL);
if (%(name)s_tmp == NULL) { %(fail)s } if (%(name)s_tmp == NULL) { %(fail)s }
if (!PyObject_IsInstance(%(name)s_tmp, (PyObject *)&GpuArrayType)) { if (!PyObject_IsInstance(%(name)s_tmp, (PyObject *)&PyGpuArrayType)) {
PyErr_SetString(PyExc_TypeError, "not a GpuArray out of the copy"); PyErr_SetString(PyExc_TypeError, "not a GpuArray out of the copy");
%(fail)s %(fail)s
} }
Py_DECREF(%(out)s); Py_DECREF(%(out)s);
%(out)s = (GpuArrayObject *)%(name)s_tmp; %(out)s = (PyGpuArrayObject *)%(name)s_tmp;
} }
""" % d """ % d
return process return process
......
...@@ -77,7 +77,7 @@ class GpuSubtensor(HideC, Subtensor): ...@@ -77,7 +77,7 @@ class GpuSubtensor(HideC, Subtensor):
// Try to reuse the python object. // Try to reuse the python object.
GpuArray_clear(&%(out)s->ga); GpuArray_clear(&%(out)s->ga);
} else { } else {
%(out)s = new_GpuArray((PyObject *)&GpuArrayType, pygpu_default_context, Py_None); %(out)s = new_GpuArray((PyObject *)&PyGpuArrayType, pygpu_default_context, Py_None);
} }
if (!%(out)s) { %(fail)s } if (!%(out)s) { %(fail)s }
int %(name)s_err; int %(name)s_err;
......
...@@ -138,7 +138,7 @@ class GpuArrayType(Type): ...@@ -138,7 +138,7 @@ class GpuArrayType(Type):
return numpy.dtype(self.dtype).itemsize return numpy.dtype(self.dtype).itemsize
def c_declare(self, name, sub): def c_declare(self, name, sub):
return "GpuArrayObject *%s;" % (name,) return "PyGpuArrayObject *%s;" % (name,)
def c_init(self, name, sub): def c_init(self, name, sub):
return "%s = NULL;" % (name,) return "%s = NULL;" % (name,)
...@@ -153,12 +153,12 @@ class GpuArrayType(Type): ...@@ -153,12 +153,12 @@ class GpuArrayType(Type):
} }
/* First check if we are the base type exactly (the most common case), /* First check if we are the base type exactly (the most common case),
then do the full subclass check if needed. */ then do the full subclass check if needed. */
if (py_%(name)s->ob_type != &GpuArrayType && if (py_%(name)s->ob_type != &PyGpuArrayType &&
!PyObject_TypeCheck(py_%(name)s, &GpuArrayType)) { !PyObject_TypeCheck(py_%(name)s, &PyGpuArrayType)) {
PyErr_SetString(PyExc_ValueError, "expected a GpuArray"); PyErr_SetString(PyExc_ValueError, "expected a GpuArray");
%(fail)s %(fail)s
} }
%(name)s = (GpuArrayObject *)py_%(name)s; %(name)s = (PyGpuArrayObject *)py_%(name)s;
Py_INCREF(%(name)s); Py_INCREF(%(name)s);
""" % {'name': name, 'fail': sub['fail']} """ % {'name': name, 'fail': sub['fail']}
...@@ -276,7 +276,7 @@ theano.compile.register_view_op_c_code(GpuArrayType, """ ...@@ -276,7 +276,7 @@ theano.compile.register_view_op_c_code(GpuArrayType, """
theano.compile.register_deep_copy_op_c_code(GpuArrayType, """ theano.compile.register_deep_copy_op_c_code(GpuArrayType, """
Py_XDECREF(%(oname)s); Py_XDECREF(%(oname)s);
%(oname)s = new_GpuArray((PyObject *)&GpuArrayType, pygpu_default_context(), Py_None); %(oname)s = new_GpuArray((PyObject *)&PyGpuArrayType, pygpu_default_context(), Py_None);
if (!%(oname)s) { %(fail)s } if (!%(oname)s) { %(fail)s }
int %(iname)s_err; int %(iname)s_err;
%(iname)s_err = GpuArray_copy(&%(oname)s->ga, &%(iname)s->ga, GA_ANY_ORDER); %(iname)s_err = GpuArray_copy(&%(oname)s->ga, &%(iname)s->ga, GA_ANY_ORDER);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论