suppress errors in vision/fair/pytorch3d

Differential Revision: D30479084

fbshipit-source-id: 6b22dd0afe4dfb1be6249e43a56657519f11dcf1
This commit is contained in:
Pyre Bot Jr 2021-08-22 23:38:17 -07:00 committed by Facebook GitHub Bot
parent 1ea2b7272a
commit fadec970c9
7 changed files with 41 additions and 6 deletions

View File

@ -144,7 +144,10 @@ def compute_extrinsic_matrix(azimuth, elevation, distance): # pragma: no cover
def read_binvox_coords( def read_binvox_coords(
f, integer_division: bool = True, dtype: torch.dtype = torch.float32 f,
integer_division: bool = True,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32,
): # pragma: no cover ): # pragma: no cover
""" """
Copied from meshrcnn codebase: Copied from meshrcnn codebase:

View File

@ -576,12 +576,21 @@ def _load_obj(
mtl_path, mtl_path,
) = _parse_obj(f_obj, data_dir) ) = _parse_obj(f_obj, data_dir)
# pyre-fixme[6]: Expected `dtype` for 3rd param but got `Type[torch.float32]`.
verts = _make_tensor(verts, cols=3, dtype=torch.float32, device=device) # (V, 3) verts = _make_tensor(verts, cols=3, dtype=torch.float32, device=device) # (V, 3)
normals = _make_tensor( normals = _make_tensor(
normals, cols=3, dtype=torch.float32, device=device normals,
cols=3,
# pyre-fixme[6]: Expected `dtype` for 3rd param but got `Type[torch.float32]`.
dtype=torch.float32,
device=device,
) # (N, 3) ) # (N, 3)
verts_uvs = _make_tensor( verts_uvs = _make_tensor(
verts_uvs, cols=2, dtype=torch.float32, device=device verts_uvs,
cols=2,
# pyre-fixme[6]: Expected `dtype` for 3rd param but got `Type[torch.float32]`.
dtype=torch.float32,
device=device,
) # (T, 2) ) # (T, 2)
faces_verts_idx = _format_faces_indices( faces_verts_idx = _format_faces_indices(

View File

@ -884,6 +884,7 @@ def _get_verts(
and vertex[0].ndim == 2 and vertex[0].ndim == 2
and vertex[0].shape[1] == 3 and vertex[0].shape[1] == 3
): ):
# pyre-fixme[6]: Expected `dtype` for 3rd param but got `Type[torch.float32]`.
return _make_tensor(vertex[0], cols=3, dtype=torch.float32), None, None return _make_tensor(vertex[0], cols=3, dtype=torch.float32), None, None
vertex_colors = None vertex_colors = None

View File

@ -58,6 +58,7 @@ def eyes(
dim: int, dim: int,
N: int, N: int,
device: Optional[torch.device] = None, device: Optional[torch.device] = None,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32, dtype: torch.dtype = torch.float32,
) -> torch.Tensor: ) -> torch.Tensor:
""" """

View File

@ -253,6 +253,8 @@ class CamerasBase(TensorProperties):
input points to the renderer to be in NDC space. input points to the renderer to be in NDC space.
""" """
if self.in_ndc(): if self.in_ndc():
# pyre-fixme[6]: Expected `dtype` for 2nd param but got
# `Type[torch.float32]`.
return Transform3d(device=self.device, dtype=torch.float32) return Transform3d(device=self.device, dtype=torch.float32)
else: else:
# For custom cameras which can be defined in screen space, # For custom cameras which can be defined in screen space,
@ -1031,6 +1033,8 @@ class PerspectiveCameras(CamerasBase):
i.e. +X left, +Y up. i.e. +X left, +Y up.
""" """
if self.in_ndc(): if self.in_ndc():
# pyre-fixme[6]: Expected `dtype` for 2nd param but got
# `Type[torch.float32]`.
ndc_transform = Transform3d(device=self.device, dtype=torch.float32) ndc_transform = Transform3d(device=self.device, dtype=torch.float32)
else: else:
# when cameras are defined in screen/image space, the principal point is # when cameras are defined in screen/image space, the principal point is
@ -1229,6 +1233,8 @@ class OrthographicCameras(CamerasBase):
i.e. +X left, +Y up. i.e. +X left, +Y up.
""" """
if self.in_ndc(): if self.in_ndc():
# pyre-fixme[6]: Expected `dtype` for 2nd param but got
# `Type[torch.float32]`.
ndc_transform = Transform3d(device=self.device, dtype=torch.float32) ndc_transform = Transform3d(device=self.device, dtype=torch.float32)
else: else:
# when cameras are defined in screen/image space, the principal point is # when cameras are defined in screen/image space, the principal point is

View File

@ -95,7 +95,11 @@ class TensorProperties(nn.Module):
""" """
def __init__( def __init__(
self, dtype: torch.dtype = torch.float32, device: Device = "cpu", **kwargs self,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32,
device: Device = "cpu",
**kwargs,
) -> None: ) -> None:
""" """
Args: Args:
@ -273,7 +277,10 @@ class TensorProperties(nn.Module):
def format_tensor( def format_tensor(
input, dtype: torch.dtype = torch.float32, device: Device = "cpu" input,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32,
device: Device = "cpu",
) -> torch.Tensor: ) -> torch.Tensor:
""" """
Helper function for converting a scalar value to a tensor. Helper function for converting a scalar value to a tensor.
@ -301,7 +308,10 @@ def format_tensor(
def convert_to_tensors_and_broadcast( def convert_to_tensors_and_broadcast(
*args, dtype: torch.dtype = torch.float32, device: Device = "cpu" *args,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32,
device: Device = "cpu",
): ):
""" """
Helper function to handle parsing an arbitrary number of inputs (*args) Helper function to handle parsing an arbitrary number of inputs (*args)

View File

@ -142,6 +142,7 @@ class Transform3d:
def __init__( def __init__(
self, self,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32, dtype: torch.dtype = torch.float32,
device: Device = "cpu", device: Device = "cpu",
matrix: Optional[torch.Tensor] = None, matrix: Optional[torch.Tensor] = None,
@ -461,6 +462,7 @@ class Translate(Transform3d):
x, x,
y=None, y=None,
z=None, z=None,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32, dtype: torch.dtype = torch.float32,
device: Optional[Device] = None, device: Optional[Device] = None,
) -> None: ) -> None:
@ -502,6 +504,7 @@ class Scale(Transform3d):
x, x,
y=None, y=None,
z=None, z=None,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32, dtype: torch.dtype = torch.float32,
device: Optional[Device] = None, device: Optional[Device] = None,
) -> None: ) -> None:
@ -547,6 +550,7 @@ class Rotate(Transform3d):
def __init__( def __init__(
self, self,
R: torch.Tensor, R: torch.Tensor,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float32]`.
dtype: torch.dtype = torch.float32, dtype: torch.dtype = torch.float32,
device: Optional[Device] = None, device: Optional[Device] = None,
orthogonal_tol: float = 1e-5, orthogonal_tol: float = 1e-5,
@ -588,6 +592,7 @@ class RotateAxisAngle(Rotate):
angle, angle,
axis: str = "X", axis: str = "X",
degrees: bool = True, degrees: bool = True,
# pyre-fixme[9]: dtype has type `dtype`; used as `Type[torch.float64]`.
dtype: torch.dtype = torch.float64, dtype: torch.dtype = torch.float64,
device: Optional[Device] = None, device: Optional[Device] = None,
) -> None: ) -> None: