From 07da36d4c86b06e02ff4569013f3e255540ef4ce Mon Sep 17 00:00:00 2001 From: Patrick Labatut Date: Wed, 9 Jun 2021 15:48:56 -0700 Subject: [PATCH] Add missing dtype parameter type annotations Summary: Add missing dtype parameter type annotations Reviewed By: nikhilaravi Differential Revision: D28943370 fbshipit-source-id: 2a411d78895f3f3aa9ab0e4807c17a13e7f25caf --- pytorch3d/datasets/r2n2/utils.py | 4 +++- pytorch3d/io/ply_io.py | 2 +- pytorch3d/ops/sample_points_from_meshes.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pytorch3d/datasets/r2n2/utils.py b/pytorch3d/datasets/r2n2/utils.py index fa9c84d2..f2c96802 100644 --- a/pytorch3d/datasets/r2n2/utils.py +++ b/pytorch3d/datasets/r2n2/utils.py @@ -137,7 +137,9 @@ def compute_extrinsic_matrix(azimuth, elevation, distance): return RT -def read_binvox_coords(f, integer_division=True, dtype=torch.float32): +def read_binvox_coords( + f, integer_division: bool = True, dtype: torch.dtype = torch.float32 +): """ Copied from meshrcnn codebase: https://github.com/facebookresearch/meshrcnn/blob/master/shapenet/utils/binvox_torch.py#L5 diff --git a/pytorch3d/io/ply_io.py b/pytorch3d/io/ply_io.py index 73bbdd92..85ae1aa3 100644 --- a/pytorch3d/io/ply_io.py +++ b/pytorch3d/io/ply_io.py @@ -462,7 +462,7 @@ def _read_ply_element_ascii(f, definition: _PlyElementType): return data -def _read_raw_array(f, aim: str, length: int, dtype=np.uint8, dtype_size=1): +def _read_raw_array(f, aim: str, length: int, dtype: type = np.uint8, dtype_size=1): """ Read [length] elements from a file. diff --git a/pytorch3d/ops/sample_points_from_meshes.py b/pytorch3d/ops/sample_points_from_meshes.py index afc573f6..58d3f26b 100644 --- a/pytorch3d/ops/sample_points_from_meshes.py +++ b/pytorch3d/ops/sample_points_from_meshes.py @@ -142,7 +142,7 @@ def sample_points_from_meshes( def _rand_barycentric_coords( - size1, size2, dtype, device + size1, size2, dtype: torch.dtype, device: torch.device ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: """ Helper function to generate random barycentric coordinates which are uniformly