From 204fe5831b3a5bbe079f09d72afb4515178f8892 Mon Sep 17 00:00:00 2001 From: generatedunixname89002005307016 Date: Mon, 19 Oct 2026 15:24:05 -0700 Subject: [PATCH] Remove unused type error suppressions (landing group 42) Summary: This Phabricator Diff was generated from Pyrefly type-checker output by the per-target upgrade tool. It was not generated by an AI coding system. It changes only type-error suppression comments: it removes suppressions that are no longer needed and adds `# pyrefly: ignore[...]` comments for remaining errors. It does not change Python runtime behavior or application logic. Landing group: `74a406ba3ec1f23501f4841695298046d3c8db50f864040e2c4b64506cdb66bd` (attempt 1, 20 batches, 391 files) Merged patch SHA-256: `c3e986b54ae5248e9810275f66372a9b2047a8e0aa14b3d3301ff8783f4e7e0e` #pyreupgrade Differential Revision: D126124958 fbshipit-source-id: f89b7d78ab77074fd80a15de7cef6f1f9fdb4237 --- pytorch3d/common/workaround/symeig3x3.py | 4 ---- pytorch3d/io/obj_io.py | 2 +- pytorch3d/renderer/implicit/harmonic_embedding.py | 4 ---- pytorch3d/renderer/mesh/rasterizer.py | 2 -- 4 files changed, 1 insertion(+), 11 deletions(-) diff --git a/pytorch3d/common/workaround/symeig3x3.py b/pytorch3d/common/workaround/symeig3x3.py index 955aa400..937485cb 100644 --- a/pytorch3d/common/workaround/symeig3x3.py +++ b/pytorch3d/common/workaround/symeig3x3.py @@ -104,7 +104,6 @@ class _SymEig3x3(nn.Module): ) p = torch.sqrt(p2 / 6.0) - # pyrefly: ignore [unsupported-operation] B = (inputs - q[..., None, None] * self._identity) / p[..., None, None] r = torch.det(B) / 2.0 @@ -189,10 +188,8 @@ class _SymEig3x3(nn.Module): """ # Find the eigenvector corresponding to alpha0, its eigenvalue is distinct - # pyrefly: ignore [unsupported-operation] ev0 = self._get_ev0(inputs - alpha0[..., None, None] * self._identity) u, v = self._get_uv(ev0) - # pyrefly: ignore [unsupported-operation] ev1 = self._get_ev1(inputs - alpha1[..., None, None] * self._identity, u, v) # Third eigenvector is computed as the cross-product of the other two ev2 = torch.cross(ev0, ev1, dim=-1) @@ -267,7 +264,6 @@ class _SymEig3x3(nn.Module): """ min_idx = w.abs().argmin(dim=-1) - # pyrefly: ignore [bad-index] rotation_2d = self._rotations_3d[min_idx].to(w) u = F.normalize((rotation_2d @ w[..., None])[..., 0], dim=-1) diff --git a/pytorch3d/io/obj_io.py b/pytorch3d/io/obj_io.py index 36b6ff53..c1dac7f1 100644 --- a/pytorch3d/io/obj_io.py +++ b/pytorch3d/io/obj_io.py @@ -794,7 +794,7 @@ def save_obj( mtl_path = str(mtl_path) # Save texture map to output folder - # pyre-fixme[16] # undefined attribute cpu + # undefined attribute cpu texture_map = texture_map.detach().cpu() * 255.0 image = Image.fromarray(texture_map.numpy().astype(np.uint8)) with _open_file(image_path, path_manager, "wb") as im_f: diff --git a/pytorch3d/renderer/implicit/harmonic_embedding.py b/pytorch3d/renderer/implicit/harmonic_embedding.py index 47382a0c..3fc2d8a7 100644 --- a/pytorch3d/renderer/implicit/harmonic_embedding.py +++ b/pytorch3d/renderer/implicit/harmonic_embedding.py @@ -136,16 +136,13 @@ class HarmonicEmbedding(torch.nn.Module): [..., (n_harmonic_functions * 2 + int(append_input)) * num_points_per_ray] """ # [..., dim, n_harmonic_functions] - # pyrefly: ignore [unsupported-operation] embed = x[..., None] * self._frequencies # [..., 1, dim, n_harmonic_functions] + [2, 1, 1] => [..., 2, dim, n_harmonic_functions] - # pyrefly: ignore [bad-index] embed = embed[..., None, :, :] + self._zero_half_pi[..., None, None] # Use the trig identity cos(x) = sin(x + pi/2) # and do one vectorized call to sin([x, x+pi/2]) instead of (sin(x), cos(x)). embed = embed.sin() if diag_cov is not None: - # pyrefly: ignore [no-matching-overload] x_var = diag_cov[..., None] * torch.pow(self._frequencies, 2) exp_var = torch.exp(-0.5 * x_var) # [..., 2, dim, n_harmonic_functions] @@ -184,7 +181,6 @@ class HarmonicEmbedding(torch.nn.Module): """ return self.get_output_dim_static( input_dims, - # pyrefly: ignore [bad-argument-type] len(self._frequencies), self.append_input, ) diff --git a/pytorch3d/renderer/mesh/rasterizer.py b/pytorch3d/renderer/mesh/rasterizer.py index bad4e070..2f7dba9c 100644 --- a/pytorch3d/renderer/mesh/rasterizer.py +++ b/pytorch3d/renderer/mesh/rasterizer.py @@ -239,12 +239,10 @@ class MeshRasterizer(nn.Module): if raster_settings.perspective_correct is not None: perspective_correct = raster_settings.perspective_correct else: - # pyrefly: ignore [missing-attribute] perspective_correct = cameras.is_perspective() if raster_settings.z_clip_value is not None: z_clip = raster_settings.z_clip_value else: - # pyrefly: ignore [missing-attribute] znear = cameras.get_znear() if isinstance(znear, torch.Tensor): znear = znear.min().item()