@@ -93,41 +93,41 @@ class ConvTransp3D(theano.Op):
R=outputs[0]
codeSource="""
///////////// < code generated by ConvTransp3D >
///////////// < code generated by ConvTransp3D >
//printf("\t\t\t\tConvTransp3D c code\\n");
//printf("\t\t\t\tConvTransp3D c code\\n");
//Check dimensionality of inputs
if (%(H)s->nd != 5)
{
//Check dimensionality of inputs
if (%(H)s->nd != 5)
{
PyErr_Format(PyExc_ValueError, "H must be a 5-D tensor but it is %%i-D",%(H)s->nd);
%(fail)s
}
}
if (%(W)s->nd != 5)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: W must be a 5-D tensor");
if (%(W)s->nd != 5)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: W must be a 5-D tensor");
%(fail)s
}
}
if (%(b)s->nd != 1)
{
if (%(b)s->nd != 1)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: b must be a vector");
%(fail)s
}
}
if (%(d)s->nd != 1)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: d must be a vector");
if (%(d)s->nd != 1)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: d must be a vector");
%(fail)s
}
}
//Read and check stride arguments
if (%(d)s->dimensions[0] != 3)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: 3 stride length arguments expected (for row, col, and time) but %%li were given", (long)%(d)s->dimensions[0] );
%(fail)s
}
//Read and check stride arguments
if (%(d)s->dimensions[0] != 3)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: 3 stride length arguments expected (for row, col, and time) but %%li were given", (long)%(d)s->dimensions[0] );
%(fail)s
}
{ // for fail 1
int dr = *(dtype_%(d)s*)PyArray_GETPTR1(%(d)s,0);
...
...
@@ -138,85 +138,85 @@ class ConvTransp3D(theano.Op):
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: Strides must all be positive but are %%i, %%i, %%i",dr,dc,dt);
%(fail)s
}
}
//Read and check sizes of inputs
//Read and check sizes of inputs
{ // for fail 2
const int batchSize = %(H)s->dimensions[0];
const int outputChannels = %(W)s->dimensions[0];
const int batchSize = %(H)s->dimensions[0];
const int outputChannels = %(W)s->dimensions[0];
if (%(H)s->dimensions[4] != outputChannels)
{
if (%(H)s->dimensions[4] != outputChannels)
{
PyErr_Format(PyExc_ValueError, "W produces a %%i channel image but the image has %%li channels. W.shape: (%%li, %%li, %%li, %%li, %%li) H.shape: (%%li, %%li, %%li, %%li, %%li)", outputChannels, (long)%(H)s->dimensions[4], (long)%(W)s->dimensions[0], (long)%(W)s->dimensions[1], (long)%(W)s->dimensions[2], (long)%(W)s->dimensions[3], (long)%(W)s->dimensions[4], (long)%(H)s->dimensions[0], (long)%(H)s->dimensions[1], (long)%(H)s->dimensions[2], (long)%(H)s->dimensions[3], (long)%(H)s->dimensions[4]);
%(fail)s
}
}
{ // for fail 3
const int inputChannels = %(W)s->dimensions[4];
if (%(b)s->dimensions[0] != inputChannels)
{
if (%(b)s->dimensions[0] != inputChannels)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: b operates on a %%li channel image but the image has %%i channels", (long)%(b)s->dimensions[0], inputChannels );
%(fail)s
}
%(fail)s
}
{ // for fail 4
const int filterHeight = %(W)s->dimensions[1];
const int filterWidth = %(W)s->dimensions[2];
const int filterDur = %(W)s->dimensions[3];
const int outputHeight = %(H)s->dimensions[1];
const int outputWidth = %(H)s->dimensions[2];
const int outputDur = %(H)s->dimensions[3];
int videoHeight = (outputHeight-1) * dr + filterHeight;
int videoWidth = (outputWidth-1) * dc + filterWidth;
int videoDur = (outputDur-1) * dt + filterDur;
if (%(RShape)s)
{
if (%(RShape)s->nd != 1)
{
const int filterHeight = %(W)s->dimensions[1];
const int filterWidth = %(W)s->dimensions[2];
const int filterDur = %(W)s->dimensions[3];
const int outputHeight = %(H)s->dimensions[1];
const int outputWidth = %(H)s->dimensions[2];
const int outputDur = %(H)s->dimensions[3];
int videoHeight = (outputHeight-1) * dr + filterHeight;
int videoWidth = (outputWidth-1) * dc + filterWidth;
int videoDur = (outputDur-1) * dt + filterDur;
if (%(RShape)s)
{
if (%(RShape)s->nd != 1)
{
PyErr_Format(PyExc_ValueError, "ConvTransp3D: RShape must be a vector");
%(fail)s
}
}
if (%(RShape)s->dimensions[0] != 3)
{
if (%(RShape)s->dimensions[0] != 3)
{
PyErr_Format(PyExc_ValueError, "RShape must specify a 3D shape ( [height,width,duration] )");
PyErr_Format(PyExc_ValueError, "Reconstruction must have physical shape of at least [%%i,%%i,%%i] but RShape argument requests that it be [%%i,%%i,%%i]\\n",videoHeight,videoWidth,videoDur,(int) RShape0,(int) RShape1,(int) RShape2);
%(fail)s
}
}
videoHeight = RShape0;
videoWidth = RShape1;
videoDur = RShape2;
}
} //closes if RShape
videoHeight = RShape0;
videoWidth = RShape1;
videoDur = RShape2;
}
} //closes if RShape
{ // for fail 5
//Allocate the reconstruction
npy_intp dims[5];
dims[0] = batchSize;
dims[4] = inputChannels;
dims[1] = videoHeight;
dims[2] = videoWidth;
dims[3] = videoDur;
npy_intp dims[5];
dims[0] = batchSize;
dims[4] = inputChannels;
dims[1] = videoHeight;
dims[2] = videoWidth;
dims[3] = videoDur;
if(!(%(R)s) || %(R)s->dimensions[0]!=dims[0] ||
%(R)s->dimensions[1]!=dims[1] ||
...
...
@@ -224,12 +224,12 @@ class ConvTransp3D(theano.Op):