raiseNotImplementedError("Only the mode valid, ignore_borders"
raiseNotImplementedError("Only the mode valid, ignore_borders"
...
@@ -64,7 +70,8 @@ class Images2Neibs(Op):
...
@@ -64,7 +70,8 @@ class Images2Neibs(Op):
= flattened version of ten4[i,j,l:l+r,k:k+c]
= flattened version of ten4[i,j,l:l+r,k:k+c]
idx += 1
idx += 1
(note: the op isn't necessarily implemented internally with these
(note: the op isn't necessarily implemented internally with these
for loops, they're just the easiest way to describe the output pattern)
for loops, they're just the easiest way to describe the output
pattern)
"""
"""
ten4=T.as_tensor_variable(ten4)
ten4=T.as_tensor_variable(ten4)
neib_shape=T.as_tensor_variable(neib_shape)
neib_shape=T.as_tensor_variable(neib_shape)
...
@@ -249,38 +256,59 @@ class Images2Neibs(Op):
...
@@ -249,38 +256,59 @@ class Images2Neibs(Op):
if ( "%(mode)s" == "wrap_centered") {
if ( "%(mode)s" == "wrap_centered") {
if (c%%2!=1 || d%%2!=1){
if (c%%2!=1 || d%%2!=1){
PyErr_Format(PyExc_TypeError, "Images2Neibs: in mode wrap_centered need patch with odd shapes");
PyErr_Format(PyExc_TypeError,
"Images2Neibs: in mode wrap_centered"
" need patch with odd shapes");
%(fail)s;
%(fail)s;
}
}
if ( (PyArray_DIMS(%(ten4)s))[2] < c || (PyArray_DIMS(%(ten4)s))[3] < d)
if ( (PyArray_DIMS(%(ten4)s))[2] < c ||
(PyArray_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=(%%ld,%%ld), ten4[2:]=[%%ld,%%ld]",