Skip to content

Instantly share code, notes, and snippets.

@franckjay
Created December 31, 2020 00:01
Show Gist options
  • Save franckjay/2e9f5898d2d7f611bc97dc75da86f44d to your computer and use it in GitHub Desktop.
Save franckjay/2e9f5898d2d7f611bc97dc75da86f44d to your computer and use it in GitHub Desktop.
B = P / (-1*P.diag())
B = B + torch.eye(B.shape[0])#Set diagonals to 0
tensor([
[ 0.0000, 0.1296, 0.1296, -0.4540, 0.6806, 0.4878],
[ 0.1296, 0.0000, 0.6806, 0.4878, 0.1296, -0.4540],
[ 0.1296, 0.6806, 0.0000, 0.4878, 0.1296, -0.4540],
[-0.2656, 0.2854, 0.2854, 0.0000, -0.2656, 0.9308],
[ 0.6806, 0.1296, 0.1296, -0.4540, 0.0000, 0.4878],
[ 0.2854, -0.2656, -0.2656, 0.9308, 0.2854, 0.0000]
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment