Now, I'm working on machine learning application which use convolve function with 'valid' option but arrayfire doesn't support it. So i'm doing full convolution and cut down area I want and I experience slow problem when I doing this (This is only test code)
- Code: Select all
array T =randu(5,5,50000)*100;
array U =randu(4,4,50000)*100;
array K = array(8,8,50000);
array O = constant(0,2,2,50000);
timer start1 = timer::start();
//If I do 50000*3 with only 1 gfor loop will got error
for(int i=0;i<30;i++){
gfor(array j,50000){
K(span,span,j)=convolve(T(span,span,j),U(span,span,j),true);
}
}
printf("Convolve elapsed seconds: %g\n", timer::stop(start1));
timer start2 = timer::start();
//Cut area I want Very Slow here
O=array(K(seq(0,1),seq(0,1),span));
printf("Cut area elapsed seconds: %g\n", timer::stop(start2));
Output: Convolve elapsed seconds : 0.250
Cut area elapsed seconds : 1.81
Any suggestion ,please?