I have an af::array for which i want to find the non zero location (2048*2048).
af::timer start1 = af::timer::start();
af::array index = af::where(mat); // for the first time
cout << "elapsed time (ms): " << af::timer::stop(start1)*1000 <<" ms"<<endl;
start1 = af::timer::start();
index = af::where(mat); //for the second time
cout << "elapsed time (ms): " << af::timer::stop(start1)*1000 <<" ms"<<endl;
First iteration:
elapsed time (ms) : 1.8792 ms
elapsed time (ms) : 0.7094 ms
Second iteration:
elapsed time (ms) : 16.8074 ms
elapsed time (ms) : 0.4738 ms
Third iteration
elpased time (ms) : 17.3236 ms
elpased time (ms) : 0.4543 ms
Why are the times is so inconsistent?