cluster.h 1.48 KB
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
#pragma once

#include <torch/extension.h>

YoannPitarch's avatar
YoannPitarch committed
5
#include "macros.h"
rusty1s's avatar
rusty1s committed
6

YoannPitarch's avatar
YoannPitarch committed
7
8
9
10
11
12
13
14
15
namespace cluster {
CLUSTER_API int64_t cuda_version() noexcept;

namespace detail {
CLUSTER_INLINE_VARIABLE int64_t _cuda_version = cuda_version();
} // namespace detail
} // namespace cluster

CLUSTER_API torch::Tensor fps(torch::Tensor src, torch::Tensor ptr, double ratio,
rusty1s's avatar
rusty1s committed
16
17
                  bool random_start);

YoannPitarch's avatar
YoannPitarch committed
18
CLUSTER_API torch::Tensor graclus(torch::Tensor rowptr, torch::Tensor col,
rusty1s's avatar
rusty1s committed
19
20
                      torch::optional<torch::Tensor> optional_weight);

YoannPitarch's avatar
YoannPitarch committed
21
CLUSTER_API torch::Tensor grid(torch::Tensor pos, torch::Tensor size,
rusty1s's avatar
rusty1s committed
22
23
24
                   torch::optional<torch::Tensor> optional_start,
                   torch::optional<torch::Tensor> optional_end);

YoannPitarch's avatar
YoannPitarch committed
25
CLUSTER_API torch::Tensor knn(torch::Tensor x, torch::Tensor y, torch::Tensor ptr_x,
rusty1s's avatar
rusty1s committed
26
27
                  torch::Tensor ptr_y, int64_t k, bool cosine);

YoannPitarch's avatar
YoannPitarch committed
28
CLUSTER_API torch::Tensor nearest(torch::Tensor x, torch::Tensor y, torch::Tensor ptr_x,
rusty1s's avatar
rusty1s committed
29
30
                      torch::Tensor ptr_y);

YoannPitarch's avatar
YoannPitarch committed
31
CLUSTER_API torch::Tensor radius(torch::Tensor x, torch::Tensor y, torch::Tensor ptr_x,
rusty1s's avatar
rusty1s committed
32
33
                     torch::Tensor ptr_y, double r, int64_t max_num_neighbors);

YoannPitarch's avatar
YoannPitarch committed
34
CLUSTER_API std::tuple<torch::Tensor, torch::Tensor>
rusty1s's avatar
rusty1s committed
35
36
random_walk(torch::Tensor rowptr, torch::Tensor col, torch::Tensor start,
            int64_t walk_length, double p, double q);
rusty1s's avatar
rusty1s committed
37

YoannPitarch's avatar
YoannPitarch committed
38
CLUSTER_API torch::Tensor neighbor_sampler(torch::Tensor start, torch::Tensor rowptr,
rusty1s's avatar
rusty1s committed
39
                               int64_t count, double factor);