Skip to content

Commit

Permalink
use torch.diagonal to set the diagonal of the laplacian (#643)
Browse files Browse the repository at this point in the history
Signed-off-by: Clement Fuji Tsang <cfujitsang@nvidia.com>

Signed-off-by: Clement Fuji Tsang <cfujitsang@nvidia.com>
  • Loading branch information
Caenorst committed Nov 2, 2022
1 parent bcce7a9 commit b47f216
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kaolin/ops/mesh/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def uniform_laplacian(num_vertices, faces):

L = torch.div(dense_adjacency, num_neighbour)

mask = torch.eye(num_vertices, num_vertices, device=faces.device, dtype=torch.bool)
L = L.masked_fill_(mask, -1)
torch.diagonal(L)[:] = -1

# Fill NaN value with 0
L[torch.isnan(L)] = 0
Expand Down

0 comments on commit b47f216

Please sign in to comment.