From 6d36c1e2b00d63d994fd4dd7d0b740f1922443df Mon Sep 17 00:00:00 2001 From: Pyre Bot Jr <> Date: Thu, 7 Oct 2021 21:56:41 -0700 Subject: [PATCH] suppress errors in `vision/fair/pytorch3d` Differential Revision: D31496551 fbshipit-source-id: 705fd88f319875db3f7938a2946c48a51ea225f5 --- pytorch3d/ops/marching_cubes.py | 1 - pytorch3d/ops/points_to_volumes.py | 2 -- pytorch3d/ops/sample_farthest_points.py | 1 - pytorch3d/renderer/blending.py | 3 +-- pytorch3d/renderer/implicit/raysampling.py | 2 +- pytorch3d/renderer/mesh/rasterize_meshes.py | 1 - pytorch3d/renderer/mesh/textures.py | 1 - pytorch3d/structures/utils.py | 1 - pytorch3d/transforms/rotation_conversions.py | 1 - pytorch3d/vis/plotly_vis.py | 2 +- 10 files changed, 3 insertions(+), 12 deletions(-) diff --git a/pytorch3d/ops/marching_cubes.py b/pytorch3d/ops/marching_cubes.py index 6b82434f..e723e427 100644 --- a/pytorch3d/ops/marching_cubes.py +++ b/pytorch3d/ops/marching_cubes.py @@ -117,7 +117,6 @@ def marching_cubes_naive( volume_data_batch = volume_data_batch.detach().cpu() batched_verts, batched_faces = [], [] D, H, W = volume_data_batch.shape[1:] - # pyre-ignore [16] volume_size_xyz = volume_data_batch.new_tensor([W, H, D])[None] if return_local_coords: diff --git a/pytorch3d/ops/points_to_volumes.py b/pytorch3d/ops/points_to_volumes.py index 4e853fab..9c87a89b 100644 --- a/pytorch3d/ops/points_to_volumes.py +++ b/pytorch3d/ops/points_to_volumes.py @@ -435,7 +435,6 @@ def _add_points_features_to_volume_densities_features_python( if volume_features is None: # initialize features if not passed in - # pyre-fixme[16]: `Tensor` has no attribute `new_zeros`. volume_features_flatten = volume_densities.new_zeros(ba, feature_dim, n_voxels) else: # otherwise just flatten @@ -478,7 +477,6 @@ def _check_points_to_volumes_inputs( mask: Optional[torch.Tensor] = None, ): - # pyre-fixme[16]: `Tuple` has no attribute `values`. max_grid_size = grid_sizes.max(dim=0).values if torch.prod(max_grid_size) > volume_densities.shape[1]: raise ValueError( diff --git a/pytorch3d/ops/sample_farthest_points.py b/pytorch3d/ops/sample_farthest_points.py index 28cc29fd..bdf62099 100644 --- a/pytorch3d/ops/sample_farthest_points.py +++ b/pytorch3d/ops/sample_farthest_points.py @@ -134,7 +134,6 @@ def sample_farthest_points_naive( # Initialize closest distances to inf, shape: (P,) # This will be updated at each iteration to track the closest distance of the # remaining points to any of the selected points - # pyre-fixme[16]: `torch.Tensor` has no attribute new_full. closest_dists = points.new_full( (lengths[n],), float("inf"), dtype=torch.float32 ) diff --git a/pytorch3d/renderer/blending.py b/pytorch3d/renderer/blending.py index 22401b81..86d59db9 100644 --- a/pytorch3d/renderer/blending.py +++ b/pytorch3d/renderer/blending.py @@ -67,7 +67,7 @@ def hard_rgb_blend( if isinstance(background_color_, torch.Tensor): background_color = background_color_.to(device) else: - background_color = colors.new_tensor(background_color_) # pyre-fixme[16] + background_color = colors.new_tensor(background_color_) # Find out how much background_color needs to be expanded to be used for masked_scatter. num_background_pixels = is_background.sum() @@ -217,7 +217,6 @@ def softmax_rgb_blend( znear = znear[:, None, None, None] z_inv = (zfar - fragments.zbuf) / (zfar - znear) * mask - # pyre-fixme[16]: `Tuple` has no attribute `values`. z_inv_max = torch.max(z_inv, dim=-1).values[..., None].clamp(min=eps) weights_num = prob_map * torch.exp((z_inv - z_inv_max) / blend_params.gamma) diff --git a/pytorch3d/renderer/implicit/raysampling.py b/pytorch3d/renderer/implicit/raysampling.py index e3b33958..0b9d4ea3 100644 --- a/pytorch3d/renderer/implicit/raysampling.py +++ b/pytorch3d/renderer/implicit/raysampling.py @@ -298,7 +298,7 @@ def _xy_to_ray_bundle( .reshape(batch_size, n_rays_per_image * 2, 2), torch.cat( ( - xy_grid.new_ones(batch_size, n_rays_per_image, 1), # pyre-ignore + xy_grid.new_ones(batch_size, n_rays_per_image, 1), 2.0 * xy_grid.new_ones(batch_size, n_rays_per_image, 1), ), dim=1, diff --git a/pytorch3d/renderer/mesh/rasterize_meshes.py b/pytorch3d/renderer/mesh/rasterize_meshes.py index 102b6033..91ff8bc5 100644 --- a/pytorch3d/renderer/mesh/rasterize_meshes.py +++ b/pytorch3d/renderer/mesh/rasterize_meshes.py @@ -475,7 +475,6 @@ def rasterize_meshes_python( # noqa: C901 ) # Calculate all face bounding boxes. - # pyre-fixme[16]: `Tuple` has no attribute `values`. x_mins = torch.min(faces_verts[:, :, 0], dim=1, keepdim=True).values x_maxs = torch.max(faces_verts[:, :, 0], dim=1, keepdim=True).values y_mins = torch.min(faces_verts[:, :, 1], dim=1, keepdim=True).values diff --git a/pytorch3d/renderer/mesh/textures.py b/pytorch3d/renderer/mesh/textures.py index 833f1a48..66b272f0 100644 --- a/pytorch3d/renderer/mesh/textures.py +++ b/pytorch3d/renderer/mesh/textures.py @@ -1134,7 +1134,6 @@ class TexturesUV(TexturesBase): ) merging_plan = pack_unique_rectangles(heights_and_widths) C = maps[0].shape[-1] - # pyre-fixme[16]: `Tensor` has no attribute `new_zeros`. single_map = maps[0].new_zeros((*merging_plan.total_size, C)) verts_uvs = self.verts_uvs_list() verts_uvs_merged = [] diff --git a/pytorch3d/structures/utils.py b/pytorch3d/structures/utils.py index 2db34e4f..8f9438c0 100644 --- a/pytorch3d/structures/utils.py +++ b/pytorch3d/structures/utils.py @@ -52,7 +52,6 @@ def list_to_padded( # replace empty 1D tensors with empty tensors with a correct number of dimensions x = [ - # pyre-fixme[16]: `Tensor` has no attribute `new_zeros`. (y.new_zeros([0] * element_ndim) if (y.ndim == 1 and y.nelement() == 0) else y) for y in x ] diff --git a/pytorch3d/transforms/rotation_conversions.py b/pytorch3d/transforms/rotation_conversions.py index 96f20065..98b22ca2 100644 --- a/pytorch3d/transforms/rotation_conversions.py +++ b/pytorch3d/transforms/rotation_conversions.py @@ -142,7 +142,6 @@ def matrix_to_quaternion(matrix: torch.Tensor) -> torch.Tensor: # We floor here at 0.1 but the exact level is not important; if q_abs is small, # the candidate won't be picked. - # pyre-ignore [16]: `torch.Tensor` has no attribute `new_tensor`. quat_candidates = quat_by_rijk / (2.0 * q_abs[..., None].max(q_abs.new_tensor(0.1))) # if not for numerical problems, quat_candidates[i] should be same (up to a sign), diff --git a/pytorch3d/vis/plotly_vis.py b/pytorch3d/vis/plotly_vis.py index 4a1dcf86..05749219 100644 --- a/pytorch3d/vis/plotly_vis.py +++ b/pytorch3d/vis/plotly_vis.py @@ -791,7 +791,7 @@ def _add_ray_bundle_trace( # make ray line endpoints min_max_ray_depth = torch.stack( [ - ray_bundle_flat.lengths.min(dim=1).values, # pyre-ignore[16] + ray_bundle_flat.lengths.min(dim=1).values, ray_bundle_flat.lengths.max(dim=1).values, ], dim=-1,