@@ -339,26 +403,46 @@ class GpuImages2Neibs(Images2Neibs):
const int c = *(dtype_%(neib_shape)s*) PyArray_GETPTR1(%(neib_shape)s, 0);
const int d = *(dtype_%(neib_shape)s*) PyArray_GETPTR1(%(neib_shape)s, 1);
//const float * cd = CudaNdarray_DEV_DATA(%(neib_shape)s);
//const int c = (int) cd[0];
//const int d = (int) cd[1];
if ( CudaNdarray_HOST_DIMS(%(ten4)s)[2] %% c != 0)
{
PyErr_Format(PyExc_TypeError, "neib_shape[0] must divide ten4.shape[2]");
%(fail)s;
}
if ( CudaNdarray_HOST_DIMS(%(ten4)s)[3] %% d != 0)
{
PyErr_Format(PyExc_TypeError, "neib_shape[1] must divide ten4.shape[3]");
%(fail)s;
const int step_x = c;//will change when we implement neib_step
const int step_y = d;//will change when we implement neib_step
if ( "%(mode)s" == "wrap_centered") {
if (c%%2!=1 || d%%2!=1){
PyErr_Format(PyExc_TypeError, "Images2Neibs: in mode wrap_centered need patch with odd shapes");
%(fail)s;
}
if ( CudaNdarray_HOST_DIMS(%(ten4)s)[2] < c || CudaNdarray_HOST_DIMS(%(ten4)s)[3] < d)
{
PyErr_Format(PyExc_TypeError, "Images2Neibs: in wrap_centered mode, don't support image shapes smaller then the patch shapes: neib_shape=(%%d,%%d), ten4[2:]=[%%d,%%d]",