From b530b0af3224ced55871c12ab67b79a419523c25 Mon Sep 17 00:00:00 2001 From: Nikhila Ravi Date: Wed, 15 Apr 2020 21:56:48 -0700 Subject: [PATCH] lint fixes Summary: Resolved trailing whitespace warnings. Reviewed By: gkioxari Differential Revision: D21023982 fbshipit-source-id: 14ea2ca372c13cfa987acc260264ca99ce44c461 --- pytorch3d/loss/point_mesh_distance.py | 14 +++++++------- pytorch3d/ops/knn.py | 6 +++--- tests/test_point_mesh_distance.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pytorch3d/loss/point_mesh_distance.py b/pytorch3d/loss/point_mesh_distance.py index 7fde9aca..70ffeced 100644 --- a/pytorch3d/loss/point_mesh_distance.py +++ b/pytorch3d/loss/point_mesh_distance.py @@ -41,10 +41,10 @@ class _PointFaceDistance(Function): in the corresponding example in the batch idxs: LongTensor of shape `(P,)` indicating the closest triangular face in the corresponindg example in the batch. - + `dists[p] = d(points[p], tris[idxs[p], 0], tris[idxs[p], 1], tris[idxs[p], 2])` where `d(u, v0, v1, v2)` is the distance of point `u` from the trianfular face `(v0, v1, v2)` - + """ dists, idxs = _C.point_face_dist_forward( points, points_first_idx, tris, tris_first_idx, max_points @@ -91,7 +91,7 @@ class _FacePointDistance(Function): corresponding example in the batch idxs: LongTensor of shape `(T,)` indicating the closest point in the corresponindg example in the batch. - + `dists[t] = d(points[idxs[t]], tris[t, 0], tris[t, 1], tris[t, 2])`, where `d(u, v0, v1, v2)` is the distance of point `u` from the triangular face `(v0, v1, v2)`. @@ -141,7 +141,7 @@ class _PointEdgeDistance(Function): corresponding example in the batch idxs: LongTensor of shape `(P,)` indicating the closest edge in the corresponindg example in the batch. - + `dists[p] = d(points[p], segms[idxs[p], 0], segms[idxs[p], 1])`, where `d(u, v0, v1)` is the distance of point `u` from the edge segment spanned by `(v0, v1)`. @@ -191,7 +191,7 @@ class _EdgePointDistance(Function): corresponding example in the batch idxs: LongTensor of shape `(S,)` indicating the closest point in the corresponindg example in the batch. - + `dists[s] = d(points[idxs[s]], edges[s, 0], edges[s, 1])`, where `d(u, v0, v1)` is the distance of point `u` from the segment spanned by `(v0, v1)`. @@ -226,7 +226,7 @@ def point_mesh_edge_distance(meshes: Meshes, pcls: Pointclouds): to the closest edge segment in mesh and averages across all points in pcl `edge_point(mesh, pcl)`: Computes the squared distance of each edge segment in mesh to the closest point in pcl and averages across all edges in mesh. - + The above distance functions are applied for all `(mesh, pcl)` pairs in the batch and then averaged across the batch. @@ -293,7 +293,7 @@ def point_mesh_face_distance(meshes: Meshes, pcls: Pointclouds): to the closest triangular face in mesh and averages across all points in pcl `face_point(mesh, pcl)`: Computes the squared distance of each triangular face in mesh to the closest point in pcl and averages across all faces in mesh. - + The above distance functions are applied for all `(mesh, pcl)` pairs in the batch and then averaged across the batch. diff --git a/pytorch3d/ops/knn.py b/pytorch3d/ops/knn.py index 1043592b..3ec6e3f0 100644 --- a/pytorch3d/ops/knn.py +++ b/pytorch3d/ops/knn.py @@ -125,7 +125,7 @@ def knn_points( p1_dists: Tensor of shape (N, P1, K) giving the squared distances to the nearest neighbors. This is padded with zeros both where a cloud in p2 has fewer than K points and where a cloud in p1 has fewer than P1 points. - + p2_nn: Tensor of shape (N, P1, K, D) giving the K nearest neighbors in p2 for each point in p1. Concretely, `p2_nn[n, i, k]` gives the k-th nearest neighbor for `p1[n, i]`. Returned if `return_nn` is True. @@ -134,7 +134,7 @@ def knn_points( .. code-block:: p2_nn = knn_gather(p2, p1_idx, lengths2) - + which is a helper function that allows indexing any tensor of shape (N, P2, U) with the indices `p1_idx` returned by `knn_points`. The outout is a tensor of shape (N, P1, K, U). @@ -168,7 +168,7 @@ def knn_gather( """ A helper function for knn that allows indexing a tensor x with the indices `idx` returned by `knn_points`. - + For example, if `dists, idx = knn_points(p, x, lengths_p, lengths, K)` where p is a tensor of shape (N, L, D) and x a tensor of shape (N, M, D), then one can compute the K nearest neighbors of p with `p_nn = knn_gather(x, idx, lengths)`. diff --git a/tests/test_point_mesh_distance.py b/tests/test_point_mesh_distance.py index 436a1436..96be9854 100644 --- a/tests/test_point_mesh_distance.py +++ b/tests/test_point_mesh_distance.py @@ -132,7 +132,7 @@ class TestPointMeshDistance(TestCaseMixin, unittest.TestCase): edge: FloatTensor of shape (2, 3) Returns: dist: FloatTensor of shape (1) - + If a, b are the start and end points of the segments, we parametrize a point p as x(t) = a + t * (b - a) @@ -165,7 +165,7 @@ class TestPointMeshDistance(TestCaseMixin, unittest.TestCase): point: FloatTensor of shape (3) tri: FloatTensor of shape (3, 3) Returns: - dist: FloatTensor of shape (1) + dist: FloatTensor of shape (1) """ a, b, c = tri.unbind(0) cross = torch.cross(b - a, c - a)