lint fixes

Summary:
Ran the linter.
TODO: need to update the linter as per D21353065.

Reviewed By: bottler

Differential Revision: D21362270

fbshipit-source-id: ad0e781de0a29f565ad25c43bc94a19b1828c020
This commit is contained in:
Nikhila Ravi
2020-05-04 09:55:03 -07:00
committed by Facebook GitHub Bot
parent 0c595dcf5b
commit 0eca74fa5f
15 changed files with 73 additions and 57 deletions

View File

@@ -80,7 +80,7 @@ def make_mesh_texture_atlas(
faces_material_ind = torch.from_numpy(face_material_names == material_name).to(
faces_verts_uvs.device
)
if (faces_material_ind).sum() > 0:
if faces_material_ind.sum() > 0:
# For these faces, update the base color to the
# diffuse material color.
if "diffuse_color" not in props:

View File

@@ -117,8 +117,8 @@ def chamfer_distance(
P2 = y.shape[1]
# Check if inputs are heterogeneous and create a lengths mask.
is_x_heterogeneous = ~(x_lengths == P1).all()
is_y_heterogeneous = ~(y_lengths == P2).all()
is_x_heterogeneous = (x_lengths != P1).any()
is_y_heterogeneous = (y_lengths != P2).any()
x_mask = (
torch.arange(P1, device=x.device)[None] >= x_lengths[:, None]
) # shape [N, P1]

View File

@@ -259,7 +259,7 @@ def rasterize_meshes_python(
N = len(meshes)
# Assume only square images.
# TODO(T52813608) extend support for non-square images.
H, W, = image_size, image_size
H, W = image_size, image_size
K = faces_per_pixel
device = meshes.device
@@ -479,7 +479,7 @@ def point_line_distance(p, v0, v1):
if l2 <= kEpsilon:
return (p - v1).dot(p - v1) # v0 == v1
t = (v1v0).dot(p - v0) / l2
t = v1v0.dot(p - v0) / l2
t = torch.clamp(t, min=0.0, max=1.0)
p_proj = v0 + t * v1v0
delta_p = p_proj - p

View File

@@ -308,7 +308,7 @@ def convert_to_tensors_and_broadcast(*args, dtype=torch.float32, device: str = "
args_Nd = []
for c in args_1d:
if c.shape[0] != 1 and c.shape[0] != N:
msg = "Got non-broadcastable sizes %r" % (sizes)
msg = "Got non-broadcastable sizes %r" % sizes
raise ValueError(msg)
# Expand broadcast dim and keep non broadcast dims the same size

View File

@@ -926,8 +926,8 @@ class Meshes(object):
self._num_verts_per_mesh = torch.zeros(
(0,), dtype=torch.int64, device=self.device
)
self._faces_packed = -torch.ones(
(0, 3), dtype=torch.int64, device=self.device
self._faces_packed = -(
torch.ones((0, 3), dtype=torch.int64, device=self.device)
)
self._faces_packed_to_mesh_idx = torch.zeros(
(0,), dtype=torch.int64, device=self.device
@@ -977,8 +977,8 @@ class Meshes(object):
return
if self.isempty():
self._edges_packed = -torch.ones(
(0, 2), dtype=torch.int64, device=self.device
self._edges_packed = torch.full(
(0, 2), fill_value=-1, dtype=torch.int64, device=self.device
)
self._edges_packed_to_mesh_idx = torch.zeros(
(0,), dtype=torch.int64, device=self.device