Continuing the discussion from How to do a unravel_index in pytorch just like in numpy:
AFAIK unravel_index is basically converting a 1D index into its corresponding 2D version.
The general formula for this is:
x = index / ncols # (integer division in pytorch tensors is just `/` not `//`)
y = index % ncols

So you can get what you want using this code:
index = torch.tensor([22, 41, 37])
rows = index / 6
cols = index % 6

print(rows)
print(cols)
tensor([ 3,  6,  6])
tensor([ 4,  5,  1])