Hi @albanD,
I found the bug. I didn’t realize that ATen functions were generating those ranges for kernel threads inside the functions. Thanks for your help.
By the way, I see in a lot of codes a pattern like this:
at::Tensor t = at::empty({5, 10}); // creating tensor with at function
then
int* t2 = t.data<int>(); // getting the raw data
then
t2[row_idx*10 + col_idx] = value; //assigning values to t2
Do you know why people write like this instead of just using aten tensor directly like this:
at::Tensor t = at::empty({5, 10}); // creating tensor with at function
t[row_idx][col_idx] = value;

I think is something obvious, but I’m maybe too tired to understand. 
Thank you again!