From e58a730e6ad6e4878e1785023b5e6333690b9211 Mon Sep 17 00:00:00 2001 From: Penn Date: Fri, 22 Jan 2021 11:01:58 -0800 Subject: [PATCH] Fix dimension check (#524) Summary: Fixes the assertion that `p1` and `p2` have the same last dimension. The issue was that `D` is set to equal `p2.size(2)`, and then `D` is compared to `p2.size(2)`. The fix instead compares `D` to `p1.size(2). Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/524 Reviewed By: bottler Differential Revision: D26008688 Pulled By: nikhilaravi fbshipit-source-id: e32afe9da127d81b1a411d3c223b539a7400597b --- pytorch3d/csrc/knn/knn.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch3d/csrc/knn/knn.cu b/pytorch3d/csrc/knn/knn.cu index c679362e..c4c87d7c 100644 --- a/pytorch3d/csrc/knn/knn.cu +++ b/pytorch3d/csrc/knn/knn.cu @@ -505,7 +505,7 @@ std::tuple KNearestNeighborBackwardCuda( const auto D = p2.size(2); const auto K = idxs.size(2); - TORCH_CHECK(p2.size(2) == D, "Point sets must have the same last dimension"); + TORCH_CHECK(p1.size(2) == D, "Point sets must have the same last dimension"); TORCH_CHECK(idxs.size(0) == N, "KNN idxs must have the same batch dimension"); TORCH_CHECK( idxs.size(1) == P1, "KNN idxs must have the same point dimension as p1");