Further, inside a gfor for an dimensional array, i like to perform compare operation, each element pointed by index of gfor, compare with set of elements in that array and if greater than threshold update with 1 else 0
#if 1
af::array t_range(af::array t_output, uint16_t t_cell, uint16_t t_cells, float th) {
af::array t_input = flat(t_output);
af::array t_output(t_input.dims(0));
auto row = t_input.dims(0);
auto total = (t_cells + t_cell);
af::timer start1 = af::timer::start();
gfor(af::seq k, total, row - (total + 1)) {
t_output(k) = t_input(k) - (th + (af::sum(t_input(af::seq(k.operator-(total).s.begin, k.operator-(t_cell + 1).s.begin))) +
af::sum(t_input(af::seq(k.operator+(t_cell + 1).s.begin, k.operator+(total).s.begin)))) / 2);
}
af::dim4 new_dims(7, 4);
t_output = af::moddims(t_output, new_dims);
printf("elapsed time: %g ms\n", af::timer::stop(start1) * 1000);
return t_output;
}
#endif
t_input(af::seq(k.operator-(total).s.begin - this portion of code is written to index k+1 bcoz direct indexing k+1 is giving error (operator overload error)