>>> t = torch.randn(5, 5)
>>> ind = np.diag_indices(t.shape[0])
>>> t[ind[0], ind[1]] = torch.zeros(t.shape[0])
>>> t
tensor([[ 0.0000, -1.2111,  2.0369, -0.7607,  0.1844],
        [ 1.2293,  0.0000, -1.0472, -0.5150,  0.1518],
        [ 0.1972, -0.3708,  0.0000, -1.2243,  0.1612],
        [-0.1637, -1.2848, -0.1972,  0.0000,  1.3353],
        [ 1.1711,  0.9332,  0.0911, -0.3391,  0.0000]])