From 3aadd19a2b2c40da38e3e997ba3856d8ebd67626 Mon Sep 17 00:00:00 2001 From: generatedunixname1417043136753450 Date: Sun, 22 Feb 2026 06:57:57 -0800 Subject: [PATCH] fbcode/vision/fair/pytorch3d/pytorch3d/ops/laplacian_matrices.py Reviewed By: bottler Differential Revision: D93708383 fbshipit-source-id: 7576f0c9800ed3d28795e521be5c63799b7e6676 --- pytorch3d/ops/laplacian_matrices.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pytorch3d/ops/laplacian_matrices.py b/pytorch3d/ops/laplacian_matrices.py index ac80ca58..9227ba5d 100644 --- a/pytorch3d/ops/laplacian_matrices.py +++ b/pytorch3d/ops/laplacian_matrices.py @@ -55,11 +55,9 @@ def laplacian(verts: torch.Tensor, edges: torch.Tensor) -> torch.Tensor: # We construct the Laplacian matrix by adding the non diagonal values # i.e. L[i, j] = 1 ./ deg(i) if (i, j) is an edge deg0 = deg[e0] - # pyre-fixme[58]: `/` is not supported for operand types `float` and `Tensor`. - deg0 = torch.where(deg0 > 0.0, 1.0 / deg0, deg0) + deg0 = torch.where(deg0 > 0.0, torch.reciprocal(deg0), deg0) deg1 = deg[e1] - # pyre-fixme[58]: `/` is not supported for operand types `float` and `Tensor`. - deg1 = torch.where(deg1 > 0.0, 1.0 / deg1, deg1) + deg1 = torch.where(deg1 > 0.0, torch.reciprocal(deg1), deg1) val = torch.cat([deg0, deg1]) L = torch.sparse_coo_tensor(idx, val, (V, V), dtype=torch.float32) @@ -137,8 +135,7 @@ def cot_laplacian( val = torch.stack([area] * 3, dim=1).view(-1) inv_areas.scatter_add_(0, idx, val) idx = inv_areas > 0 - # pyre-fixme[58]: `/` is not supported for operand types `float` and `Tensor`. - inv_areas[idx] = 1.0 / inv_areas[idx] + inv_areas[idx] = torch.reciprocal(inv_areas[idx]) inv_areas = inv_areas.view(-1, 1) return L, inv_areas