Skip to content

Commit 4ba8cf8

Browse files
authored
c10::optional -> std::optional (#239)
1 parent 4126a52 commit 4ba8cf8

21 files changed

+42
-42
lines changed

csrc/cluster.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ CLUSTER_API torch::Tensor fps(torch::Tensor src, torch::Tensor ptr, torch::Tenso
1414
bool random_start);
1515

1616
CLUSTER_API torch::Tensor graclus(torch::Tensor rowptr, torch::Tensor col,
17-
torch::optional<torch::Tensor> optional_weight);
17+
std::optional<torch::Tensor> optional_weight);
1818

1919
CLUSTER_API torch::Tensor grid(torch::Tensor pos, torch::Tensor size,
20-
torch::optional<torch::Tensor> optional_start,
21-
torch::optional<torch::Tensor> optional_end);
20+
std::optional<torch::Tensor> optional_start,
21+
std::optional<torch::Tensor> optional_end);
2222

2323
CLUSTER_API torch::Tensor knn(torch::Tensor x, torch::Tensor y,
24-
torch::optional<torch::Tensor> ptr_x,
25-
torch::optional<torch::Tensor> ptr_y, int64_t k, bool cosine,
24+
std::optional<torch::Tensor> ptr_x,
25+
std::optional<torch::Tensor> ptr_y, int64_t k, bool cosine,
2626
int64_t num_workers);
2727

2828
CLUSTER_API torch::Tensor nearest(torch::Tensor x, torch::Tensor y, torch::Tensor ptr_x,

csrc/cpu/graclus_cpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "utils.h"
44

55
torch::Tensor graclus_cpu(torch::Tensor rowptr, torch::Tensor col,
6-
torch::optional<torch::Tensor> optional_weight) {
6+
std::optional<torch::Tensor> optional_weight) {
77
CHECK_CPU(rowptr);
88
CHECK_CPU(col);
99
CHECK_INPUT(rowptr.dim() == 1 && col.dim() == 1);

csrc/cpu/graclus_cpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#include "../extensions.h"
44

55
torch::Tensor graclus_cpu(torch::Tensor rowptr, torch::Tensor col,
6-
torch::optional<torch::Tensor> optional_weight);
6+
std::optional<torch::Tensor> optional_weight);

csrc/cpu/grid_cpu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include "utils.h"
44

55
torch::Tensor grid_cpu(torch::Tensor pos, torch::Tensor size,
6-
torch::optional<torch::Tensor> optional_start,
7-
torch::optional<torch::Tensor> optional_end) {
6+
std::optional<torch::Tensor> optional_start,
7+
std::optional<torch::Tensor> optional_end) {
88

99
CHECK_CPU(pos);
1010
CHECK_CPU(size);

csrc/cpu/grid_cpu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
#include "../extensions.h"
44
torch::Tensor grid_cpu(torch::Tensor pos, torch::Tensor size,
5-
torch::optional<torch::Tensor> optional_start,
6-
torch::optional<torch::Tensor> optional_end);
5+
std::optional<torch::Tensor> optional_start,
6+
std::optional<torch::Tensor> optional_end);

csrc/cpu/knn_cpu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "utils/nanoflann.hpp"
66

77
torch::Tensor knn_cpu(torch::Tensor x, torch::Tensor y,
8-
torch::optional<torch::Tensor> ptr_x,
9-
torch::optional<torch::Tensor> ptr_y, int64_t k,
8+
std::optional<torch::Tensor> ptr_x,
9+
std::optional<torch::Tensor> ptr_y, int64_t k,
1010
int64_t num_workers) {
1111

1212
CHECK_CPU(x);

csrc/cpu/knn_cpu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
#include "../extensions.h"
44

55
torch::Tensor knn_cpu(torch::Tensor x, torch::Tensor y,
6-
torch::optional<torch::Tensor> ptr_x,
7-
torch::optional<torch::Tensor> ptr_y, int64_t k,
6+
std::optional<torch::Tensor> ptr_x,
7+
std::optional<torch::Tensor> ptr_y, int64_t k,
88
int64_t num_workers);

csrc/cpu/radius_cpu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "utils/nanoflann.hpp"
66

77
torch::Tensor radius_cpu(torch::Tensor x, torch::Tensor y,
8-
torch::optional<torch::Tensor> ptr_x,
9-
torch::optional<torch::Tensor> ptr_y, double r,
8+
std::optional<torch::Tensor> ptr_x,
9+
std::optional<torch::Tensor> ptr_y, double r,
1010
int64_t max_num_neighbors, int64_t num_workers,
1111
bool ignore_same_index) {
1212

csrc/cpu/radius_cpu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "../extensions.h"
44

55
torch::Tensor radius_cpu(torch::Tensor x, torch::Tensor y,
6-
torch::optional<torch::Tensor> ptr_x,
7-
torch::optional<torch::Tensor> ptr_y, double r,
6+
std::optional<torch::Tensor> ptr_x,
7+
std::optional<torch::Tensor> ptr_y, double r,
88
int64_t max_num_neighbors, int64_t num_workers,
99
bool ignore_same_index);

csrc/cuda/graclus_cuda.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ __global__ void weighted_propose_kernel(int64_t *out, int64_t *proposal,
103103

104104
void propose(torch::Tensor out, torch::Tensor proposal, torch::Tensor rowptr,
105105
torch::Tensor col,
106-
torch::optional<torch::Tensor> optional_weight) {
106+
std::optional<torch::Tensor> optional_weight) {
107107

108108
auto stream = at::cuda::getCurrentCUDAStream();
109109

@@ -192,7 +192,7 @@ __global__ void weighted_respond_kernel(int64_t *out, const int64_t *proposal,
192192

193193
void respond(torch::Tensor out, torch::Tensor proposal, torch::Tensor rowptr,
194194
torch::Tensor col,
195-
torch::optional<torch::Tensor> optional_weight) {
195+
std::optional<torch::Tensor> optional_weight) {
196196

197197
auto stream = at::cuda::getCurrentCUDAStream();
198198

@@ -214,7 +214,7 @@ void respond(torch::Tensor out, torch::Tensor proposal, torch::Tensor rowptr,
214214
}
215215

216216
torch::Tensor graclus_cuda(torch::Tensor rowptr, torch::Tensor col,
217-
torch::optional<torch::Tensor> optional_weight) {
217+
std::optional<torch::Tensor> optional_weight) {
218218
CHECK_CUDA(rowptr);
219219
CHECK_CUDA(col);
220220
CHECK_INPUT(rowptr.dim() == 1 && col.dim() == 1);

0 commit comments

Comments
 (0)