mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2026-10-17 03:35: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(
|
||||
# pyrefly: ignore [bad-argument-type]
|
||||
focal_length=focal_length,
|
||||
principal_point=principal_point,
|
||||
R=R,
|
||||
T=T,
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
device=focal_length.device,
|
||||
)
|
||||
|
||||
|
||||
@@ -340,8 +340,11 @@ def corresponding_points_alignment(
|
||||
total_weight = torch.clamp(num_points, 1)
|
||||
# special handling for heterogeneous point clouds and/or input weights
|
||||
if weights is not None:
|
||||
# pyrefly: ignore [bad-index]
|
||||
Xc *= weights[:, :, None]
|
||||
# pyrefly: ignore [bad-index]
|
||||
Yc *= weights[:, :, None]
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
total_weight = torch.clamp(weights.sum(1), eps)
|
||||
|
||||
if (num_points < (dim + 1)).any():
|
||||
|
||||
@@ -427,9 +427,11 @@ class CamerasBase(TensorProperties):
|
||||
if isinstance(index, tensor_types["bool"]):
|
||||
# LongTensor]` has no attribute `ndim`.
|
||||
# LongTensor]` has no attribute `shape`.
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
if index.ndim != 1 or index.shape[0] != len(self):
|
||||
raise ValueError(
|
||||
# LongTensor]` has no attribute `shape`.
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
f"Boolean index of shape {index.shape} does not match cameras"
|
||||
)
|
||||
elif max(index) >= len(self):
|
||||
@@ -1790,11 +1792,13 @@ def get_ndc_to_screen_transform(
|
||||
image_size = torch.tensor(image_size, device=cameras.device)
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
image_size = image_size.view(-1, 2) # of shape (1 or B)x2
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
height, width = image_size.unbind(1)
|
||||
|
||||
# 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.
|
||||
# This convention is consistent with the PyTorch3D renderer
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
scale = (image_size.min(dim=1).values - 0.0) / 2.0
|
||||
|
||||
K[:, 0, 0] = scale
|
||||
|
||||
@@ -510,7 +510,9 @@ class Meshes:
|
||||
index = index.squeeze(1) if index.numel() > 0 else index
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
index = index.tolist()
|
||||
# pyrefly: ignore [not-iterable]
|
||||
verts = [self.verts_list()[i] for i in index]
|
||||
# pyrefly: ignore [not-iterable]
|
||||
faces = [self.faces_list()[i] for i in index]
|
||||
else:
|
||||
raise IndexError(index)
|
||||
|
||||
@@ -411,10 +411,13 @@ class Pointclouds:
|
||||
index = index.squeeze(1) if index.numel() > 0 else index
|
||||
# pyrefly: ignore [missing-attribute]
|
||||
index = index.tolist()
|
||||
# pyrefly: ignore [not-iterable]
|
||||
points = [self.points_list()[i] for i in index]
|
||||
if normals_list is not None:
|
||||
# pyrefly: ignore [not-iterable]
|
||||
normals = [normals_list[i] for i in index]
|
||||
if features_list is not None:
|
||||
# pyrefly: ignore [not-iterable]
|
||||
features = [features_list[i] for i in index]
|
||||
else:
|
||||
raise IndexError(index)
|
||||
|
||||
Reference in New Issue
Block a user