提交 70a7eca3 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Make the try_copy function globally available.

上级 b1ceaa95
...@@ -24,4 +24,22 @@ static int theano_prep_output(PyGpuArrayObject **out, unsigned int nd, ...@@ -24,4 +24,22 @@ static int theano_prep_output(PyGpuArrayObject **out, unsigned int nd,
return (*out == NULL) ? 1 : 0; return (*out == NULL) ? 1 : 0;
} }
static PyGpuArrayObject *theano_try_copy(PyGpuArrayObject *out,
PyGpuArrayObject *V) {
if (out &&
GpuArray_CHKFLAGS(&out->ga, GA_CARRAY) &&
theano_size_check(out, PyGpuArray_NDIM(V),
PyGpuArray_DIMS(V),
V->ga.typecode)) {
if (pygpu_move(out, V)) {
Py_XDECREF(out);
return NULL;
}
} else {
Py_XDECREF(out);
out = pygpu_copy(V, GA_C_ORDER);
}
return out;
}
#endif #endif
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论