Solved by Amine08 in post #4 
              
              
                i got it! 
Instead of using the for loop for the whole matrix, i just have to use it for the block_matrix size 
a=torch.ones(8,8)
print(a)
block_size=2
for i in range(block_size):
    a[i::4]=2*a[i::4]
print(a)