Skip to content

Commit 47c0997

Browse files
bottlerfacebook-github-bot
authored andcommitted
Followup D33970393 (auto typing)
Summary: D33970393 (e9fb6c2) ran an inference to add some typing. Remove some where it was a bit too confident. (Also fix some pyre errors in plotly_vis caused by new mismatch.) Reviewed By: patricklabatut Differential Revision: D34004689 fbshipit-source-id: 430182b0ff0b91be542a3120da6d6b1d2b247c59
1 parent e9fb6c2 commit 47c0997

File tree

5 files changed

+21
-30
lines changed

5 files changed

+21
-30
lines changed

pytorch3d/ops/points_normals.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def estimate_pointcloud_local_coord_frames(
166166
return curvatures, local_coord_frames
167167

168168

169-
def _disambiguate_vector_directions(pcl, knns, vecs: float) -> float:
169+
def _disambiguate_vector_directions(pcl, knns, vecs):
170170
"""
171171
Disambiguates normal directions according to [1].
172172
@@ -180,7 +180,6 @@ def _disambiguate_vector_directions(pcl, knns, vecs: float) -> float:
180180
# each element of the neighborhood
181181
df = knns - pcl[:, :, None]
182182
# projection of the difference on the principal direction
183-
# pyre-fixme[16]: `float` has no attribute `__getitem__`.
184183
proj = (vecs[:, :, None] * df).sum(3)
185184
# check how many projections are positive
186185
n_pos = (proj > 0).type_as(knns).sum(2, keepdim=True)

pytorch3d/ops/subdivide_meshes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def create_verts_index(verts_per_mesh, edges_per_mesh, device=None):
400400
return verts_idx
401401

402402

403-
def create_faces_index(faces_per_mesh: int, device=None):
403+
def create_faces_index(faces_per_mesh, device=None):
404404
"""
405405
Helper function to group the faces indices for each mesh. New faces are
406406
stacked at the end of the original faces tensor, so in order to have
@@ -417,9 +417,7 @@ def create_faces_index(faces_per_mesh: int, device=None):
417417
"""
418418
# e.g. faces_per_mesh = [2, 5, 3]
419419

420-
# pyre-fixme[16]: `int` has no attribute `sum`.
421420
F = faces_per_mesh.sum() # e.g. 10
422-
# pyre-fixme[16]: `int` has no attribute `cumsum`.
423421
faces_per_mesh_cumsum = faces_per_mesh.cumsum(dim=0) # (N,) e.g. (2, 7, 10)
424422

425423
switch1_idx = faces_per_mesh_cumsum.clone()

pytorch3d/renderer/cameras.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ def __getitem__(
427427

428428

429429
def OpenGLPerspectiveCameras(
430-
znear: float = 1.0,
431-
zfar: float = 100.0,
432-
aspect_ratio: float = 1.0,
433-
fov: float = 60.0,
430+
znear=1.0,
431+
zfar=100.0,
432+
aspect_ratio=1.0,
433+
fov=60.0,
434434
degrees: bool = True,
435435
R: torch.Tensor = _R,
436436
T: torch.Tensor = _T,
@@ -709,12 +709,12 @@ def in_ndc(self):
709709

710710

711711
def OpenGLOrthographicCameras(
712-
znear: float = 1.0,
713-
zfar: float = 100.0,
714-
top: float = 1.0,
715-
bottom: float = -1.0,
716-
left: float = -1.0,
717-
right: float = 1.0,
712+
znear=1.0,
713+
zfar=100.0,
714+
top=1.0,
715+
bottom=-1.0,
716+
left=-1.0,
717+
right=1.0,
718718
scale_xyz=((1.0, 1.0, 1.0),), # (1, 3)
719719
R: torch.Tensor = _R,
720720
T: torch.Tensor = _T,
@@ -956,7 +956,7 @@ def in_ndc(self):
956956

957957

958958
def SfMPerspectiveCameras(
959-
focal_length: float = 1.0,
959+
focal_length=1.0,
960960
principal_point=((0.0, 0.0),),
961961
R: torch.Tensor = _R,
962962
T: torch.Tensor = _T,
@@ -1194,7 +1194,7 @@ def in_ndc(self):
11941194

11951195

11961196
def SfMOrthographicCameras(
1197-
focal_length: float = 1.0,
1197+
focal_length=1.0,
11981198
principal_point=((0.0, 0.0),),
11991199
R: torch.Tensor = _R,
12001200
T: torch.Tensor = _T,
@@ -1645,9 +1645,9 @@ def look_at_rotation(
16451645

16461646

16471647
def look_at_view_transform(
1648-
dist: float = 1.0,
1649-
elev: float = 0.0,
1650-
azim: float = 0.0,
1648+
dist=1.0,
1649+
elev=0.0,
1650+
azim=0.0,
16511651
degrees: bool = True,
16521652
eye: Optional[Sequence] = None,
16531653
at=((0, 0, 0),), # (1, 3)

pytorch3d/vis/plotly_vis.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ def plot_scene(
259259

260260
camera = {
261261
"up": {
262-
"x": 0,
263-
"y": 1,
264-
"z": 0,
262+
"x": 0.0,
263+
"y": 1.0,
264+
"z": 0.0,
265265
} # set the up vector to match PyTorch3D world coordinates conventions
266266
}
267267
viewpoints_eye_at_up_world = None
@@ -358,14 +358,8 @@ def plot_scene(
358358
up_y = _scale_camera_to_bounds(up_y, y_range, False)
359359
up_z = _scale_camera_to_bounds(up_z, z_range, False)
360360

361-
# pyre-fixme[6]: For 2nd param expected `Dict[str, int]` but got
362-
# `Dict[str, float]`.
363361
camera["eye"] = {"x": eye_x, "y": eye_y, "z": eye_z}
364-
# pyre-fixme[6]: For 2nd param expected `Dict[str, int]` but got
365-
# `Dict[str, float]`.
366362
camera["center"] = {"x": at_x, "y": at_y, "z": at_z}
367-
# pyre-fixme[6]: For 2nd param expected `Dict[str, int]` but got
368-
# `Dict[str, float]`.
369363
camera["up"] = {"x": up_x, "y": up_y, "z": up_z}
370364

371365
current_layout.update(

pytorch3d/vis/texture_vis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def texturesuv_image_PIL(
6565
*,
6666
texture_index: int = 0,
6767
radius: float = 1,
68-
color: str = "red",
68+
color="red",
6969
subsample: Optional[int] = 10000,
7070
): # pragma: no cover
7171
"""

0 commit comments

Comments
 (0)