mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2026-10-17 19:55:43 +08:00
Suppress type errors for Pyre upgrade
Summary: This diff was automatically generated by the Pyre per-target upgrade tool. It adds `# pyrefly: ignore` comments for type errors that an upcoming Pyrefly version will report. These suppressions keep existing type-checking tests passing while the upgrade rolls out. This diff changes comments only; it does not change Python runtime behavior or application logic. pyre-upgrade-september-29 #pyreupgrade Differential Revision: D122460195 fbshipit-source-id: 2ca62cd61e77d222c5b42ac89e73fc570a9781ae
This commit is contained in:
committed by
meta-codesync[bot]
parent
978cd99221
commit
88e182f989
@@ -182,10 +182,12 @@ def generate_eval_video_cameras(
|
|||||||
)
|
)
|
||||||
|
|
||||||
test_cameras = PerspectiveCameras(
|
test_cameras = PerspectiveCameras(
|
||||||
|
# pyrefly: ignore [bad-argument-type]
|
||||||
focal_length=focal_length,
|
focal_length=focal_length,
|
||||||
principal_point=principal_point,
|
principal_point=principal_point,
|
||||||
R=R,
|
R=R,
|
||||||
T=T,
|
T=T,
|
||||||
|
# pyrefly: ignore [missing-attribute]
|
||||||
device=focal_length.device,
|
device=focal_length.device,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -340,8 +340,11 @@ def corresponding_points_alignment(
|
|||||||
total_weight = torch.clamp(num_points, 1)
|
total_weight = torch.clamp(num_points, 1)
|
||||||
# special handling for heterogeneous point clouds and/or input weights
|
# special handling for heterogeneous point clouds and/or input weights
|
||||||
if weights is not None:
|
if weights is not None:
|
||||||
|
# pyrefly: ignore [bad-index]
|
||||||
Xc *= weights[:, :, None]
|
Xc *= weights[:, :, None]
|
||||||
|
# pyrefly: ignore [bad-index]
|
||||||
Yc *= weights[:, :, None]
|
Yc *= weights[:, :, None]
|
||||||
|
# pyrefly: ignore [missing-attribute]
|
||||||
total_weight = torch.clamp(weights.sum(1), eps)
|
total_weight = torch.clamp(weights.sum(1), eps)
|
||||||
|
|
||||||
if (num_points < (dim + 1)).any():
|
if (num_points < (dim + 1)).any():
|
||||||
|
|||||||
@@ -427,9 +427,11 @@ class CamerasBase(TensorProperties):
|
|||||||
if isinstance(index, tensor_types["bool"]):
|
if isinstance(index, tensor_types["bool"]):
|
||||||
# LongTensor]` has no attribute `ndim`.
|
# LongTensor]` has no attribute `ndim`.
|
||||||
# LongTensor]` has no attribute `shape`.
|
# LongTensor]` has no attribute `shape`.
|
||||||
|
# pyrefly: ignore [missing-attribute]
|
||||||
if index.ndim != 1 or index.shape[0] != len(self):
|
if index.ndim != 1 or index.shape[0] != len(self):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
# LongTensor]` has no attribute `shape`.
|
# LongTensor]` has no attribute `shape`.
|
||||||
|
# pyrefly: ignore [missing-attribute]
|
||||||
f"Boolean index of shape {index.shape} does not match cameras"
|
f"Boolean index of shape {index.shape} does not match cameras"
|
||||||
)
|
)
|
||||||
elif max(index) >= len(self):
|
elif max(index) >= len(self):
|
||||||
@@ -1790,11 +1792,13 @@ def get_ndc_to_screen_transform(
|
|||||||
image_size = torch.tensor(image_size, device=cameras.device)
|
image_size = torch.tensor(image_size, device=cameras.device)
|
||||||
# pyrefly: ignore [missing-attribute]
|
# pyrefly: ignore [missing-attribute]
|
||||||
image_size = image_size.view(-1, 2) # of shape (1 or B)x2
|
image_size = image_size.view(-1, 2) # of shape (1 or B)x2
|
||||||
|
# pyrefly: ignore [missing-attribute]
|
||||||
height, width = image_size.unbind(1)
|
height, width = image_size.unbind(1)
|
||||||
|
|
||||||
# For non square images, we scale the points such that smallest side
|
# For non square images, we scale the points such that smallest side
|
||||||
# has range [-1, 1] and the largest side has range [-u, u], with u > 1.
|
# has range [-1, 1] and the largest side has range [-u, u], with u > 1.
|
||||||
# This convention is consistent with the PyTorch3D renderer
|
# This convention is consistent with the PyTorch3D renderer
|
||||||
|
# pyrefly: ignore [missing-attribute]
|
||||||
scale = (image_size.min(dim=1).values - 0.0) / 2.0
|
scale = (image_size.min(dim=1).values - 0.0) / 2.0
|
||||||
|
|
||||||
K[:, 0, 0] = scale
|
K[:, 0, 0] = scale
|
||||||
|
|||||||
@@ -510,7 +510,9 @@ class Meshes:
|
|||||||
index = index.squeeze(1) if index.numel() > 0 else index
|
index = index.squeeze(1) if index.numel() > 0 else index
|
||||||
# pyrefly: ignore [missing-attribute]
|
# pyrefly: ignore [missing-attribute]
|
||||||
index = index.tolist()
|
index = index.tolist()
|
||||||
|
# pyrefly: ignore [not-iterable]
|
||||||
verts = [self.verts_list()[i] for i in index]
|
verts = [self.verts_list()[i] for i in index]
|
||||||
|
# pyrefly: ignore [not-iterable]
|
||||||
faces = [self.faces_list()[i] for i in index]
|
faces = [self.faces_list()[i] for i in index]
|
||||||
else:
|
else:
|
||||||
raise IndexError(index)
|
raise IndexError(index)
|
||||||
|
|||||||
@@ -411,10 +411,13 @@ class Pointclouds:
|
|||||||
index = index.squeeze(1) if index.numel() > 0 else index
|
index = index.squeeze(1) if index.numel() > 0 else index
|
||||||
# pyrefly: ignore [missing-attribute]
|
# pyrefly: ignore [missing-attribute]
|
||||||
index = index.tolist()
|
index = index.tolist()
|
||||||
|
# pyrefly: ignore [not-iterable]
|
||||||
points = [self.points_list()[i] for i in index]
|
points = [self.points_list()[i] for i in index]
|
||||||
if normals_list is not None:
|
if normals_list is not None:
|
||||||
|
# pyrefly: ignore [not-iterable]
|
||||||
normals = [normals_list[i] for i in index]
|
normals = [normals_list[i] for i in index]
|
||||||
if features_list is not None:
|
if features_list is not None:
|
||||||
|
# pyrefly: ignore [not-iterable]
|
||||||
features = [features_list[i] for i in index]
|
features = [features_list[i] for i in index]
|
||||||
else:
|
else:
|
||||||
raise IndexError(index)
|
raise IndexError(index)
|
||||||
|
|||||||
Reference in New Issue
Block a user