I have a loop of convolve and I'm trying to replace it with gfor with the latest ArrayFire 2.1 release.

I get the following error with gfor:

"src/gena/conv.cpp:47: error: Inputs must be of same dimension"

The dimensions of the matrices are:

a dims=[64 10 64]

flipped_delta(span, span, j) dims=[59 10]

This is my code:

- Code: Select all
`for (int j = 0; j < W.dims(2); ++j) {`

//gfor(array j, W.dims(2)) {

array c_result =

ConvolveValid3d2d(a, flipped_delta(span, span, j));

c_result = reorder(c_result, 0, 2, 1);

(*dW)(span, span, j) = flip(flip(c_result, 0), 1) / delta.dims(2);

}

this is my ConvolveValid3d2d function:

- Code: Select all
`array ConvLayer::ConvolveValid3d2d(const array& a, const array& b) {`

array c = convolve(a, b, true);

int output_size0 = a.dims(0) - b.dims(0) + 1;

int output_size1 = a.dims(1) - b.dims(1) + 1;

int full_size0 = a.dims(0) + b.dims(0) - 1;

int full_size1 = a.dims(1) + b.dims(1) - 1;

int start0 = floor(float(full_size0 - output_size0) / 2);

int start1 = floor(float(full_size1 - output_size1) / 2);

c = c(seq(start0, start0 + output_size0 - 1), seq(start1, start1 + output_size1 - 1), span);

return c;

}

The for-loop works fine, but with gfor it gives the error.

Thanks.