| 18 | |
| 19 | |
| 20 | torch::Tensor SphericalKernel( |
| 21 | torch::Tensor database, // database points: concat_Np * 3 (x,y,z) |
| 22 | torch::Tensor query, // query points: concat_Mp * 3 |
| 23 | torch::Tensor nn_index, // neighbor and kernel bin indices: Nout * 2 |
| 24 | torch::Tensor nn_dist, // distance to the neighbors: Nout |
| 25 | float radius, // range search radius |
| 26 | int n_azim, // division along azimuth direction |
| 27 | int p_elev, // division along elevation direction |
| 28 | int q_radi) // division along radius direction |
| 29 | { |
| 30 | CHECK_INPUT(database,2); |
| 31 | CHECK_INPUT(query,2); |
| 32 | CHECK_INPUT(nn_index,2); |
| 33 | CHECK_INPUT(nn_dist,1); |
| 34 | |
| 35 | TORCH_CHECK(radius>0, "Range search requires radius>0"); |
| 36 | TORCH_CHECK(n_azim>2 && n_azim%2==0, "Need n_azim>2 and n_azim%2==0"); |
| 37 | TORCH_CHECK(p_elev>0 && p_elev%2==0, "Need p_elev>0 and p_elev%2==0"); |
| 38 | TORCH_CHECK(q_radi>0, "Need q_radi>0"); |
| 39 | |
| 40 | // get the dims required by computations |
| 41 | int Np = database.size(0); // number of database points |
| 42 | int Mp = query.size(0); // number of query points |
| 43 | int Nout = nn_index.size(0); // number of neighbor pairs |
| 44 | |
| 45 | TORCH_CHECK(database.dim()==2 && database.size(1)==3, |
| 46 | "Shape of database points requires to be (Np, 3)"); |
| 47 | TORCH_CHECK(query.dim()==2 && query.size(1)==3, |
| 48 | "Shape of query points requires to be (Mp, 3)"); |
| 49 | TORCH_CHECK(nn_index.dim()==2 && nn_index.size(1)==2, |
| 50 | "Shape of database points requires to be (Nout, 2)"); |
| 51 | |
| 52 | // get pointers to the input tensors |
| 53 | const float* database_ptr = database.data_ptr<float>(); |
| 54 | const float* query_ptr = query.data_ptr<float>(); |
| 55 | const int* nnIndex_ptr = nn_index.data_ptr<int32_t>(); |
| 56 | const float* nnDist_ptr = nn_dist.data_ptr<float>(); |
| 57 | |
| 58 | // create an output tensor |
| 59 | auto filt_index = torch::zeros({Nout}, nn_index.options()); |
| 60 | int* filtIndex_ptr = filt_index.data_ptr<int32_t>(); |
| 61 | |
| 62 | sphericalKernelLauncher(Nout, n_azim, p_elev, q_radi, radius, database_ptr, |
| 63 | query_ptr, nnIndex_ptr, nnDist_ptr, filtIndex_ptr); |
| 64 | return filt_index; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | std::vector<torch::Tensor> FuzzySphericalKernel( |
nothing calls this directly
no outgoing calls
no test coverage detected