|
| 1 | +#include <ATen/ATen.h> |
| 2 | + |
| 3 | +at::Tensor graclus_cuda(at::Tensor row, at::Tensor col, int64_t num_nodes) { |
| 4 | + auto cluster = at::full(num_nodes, -1, row.options()); |
| 5 | + return cluster; |
| 6 | +} |
| 7 | + |
| 8 | +at::Tensor weighted_graclus_cuda(at::Tensor row, at::Tensor col, |
| 9 | + at::Tensor weight, int64_t num_nodes) { |
| 10 | + auto cluster = at::full(num_nodes, -1, row.options()); |
| 11 | + return cluster; |
| 12 | +} |
| 13 | + |
| 14 | +// #include "color.cuh" |
| 15 | +// #include "common.cuh" |
| 16 | + |
| 17 | +// at::Tensor graclus(at::Tensor row, at::Tensor col, int num_nodes) { |
| 18 | +// // Remove self-loops. |
| 19 | +// auto mask = row != col; |
| 20 | +// row = row.masked_select(mask); |
| 21 | +// col.masked_select(mask); |
| 22 | + |
| 23 | +// // Sort by row index. |
| 24 | +// at::Tensor perm; |
| 25 | +// std::tie(row, perm) = row.sort(); |
| 26 | +// col = col.index_select(0, perm); |
| 27 | + |
| 28 | +// // Generate helper vectors. |
| 29 | +// auto cluster = at::full(row.type(), {num_nodes}, -1); |
| 30 | +// auto prop = at::full(row.type(), {num_nodes}, -1); |
| 31 | +// auto deg = degree(row, num_nodes); |
| 32 | +// auto cum_deg = deg.cumsum(0); |
| 33 | + |
| 34 | +// color(cluster); |
| 35 | + |
| 36 | +// /* while (!color(cluster)) { */ |
| 37 | +// /* propose(cluster, prop, row, col, weight, deg, cum_deg); */ |
| 38 | +// /* response(cluster, prop, row, col, weight, deg, cum_deg); */ |
| 39 | +// /* } */ |
| 40 | + |
| 41 | +// return cluster; |
| 42 | +// } |
| 43 | + |
| 44 | +// at::Tensor weighted_graclus(at::Tensor row, at::Tensor col, at::Tensor |
| 45 | +// weight, |
| 46 | +// int num_nodes) { |
| 47 | +// // Remove self-loops. |
| 48 | +// auto mask = row != col; |
| 49 | +// row = row.masked_select(mask); |
| 50 | +// col = col.masked_select(mask); |
| 51 | +// weight = weight.masked_select(mask); |
| 52 | + |
| 53 | +// // Sort by row index. |
| 54 | +// at::Tensor perm; |
| 55 | +// std::tie(row, perm) = row.sort(); |
| 56 | +// col = col.index_select(0, perm); |
| 57 | +// weight = weight.index_select(0, perm); |
| 58 | + |
| 59 | +// // Generate helper vectors. |
| 60 | +// auto cluster = at::full(row.type(), {num_nodes}, -1); |
| 61 | +// auto prop = at::full(row.type(), {num_nodes}, -1); |
| 62 | +// auto deg = degree(row, num_nodes); |
| 63 | +// auto cum_deg = deg.cumsum(0); |
| 64 | + |
| 65 | +// color(cluster); |
| 66 | + |
| 67 | +// /* while (!color(cluster)) { */ |
| 68 | +// /* weighted_propose(cluster, prop, row, col, weight, deg, cum_deg); */ |
| 69 | +// /* weighted_response(cluster, prop, row, col, weight, deg, cum_deg); */ |
| 70 | +// /* } */ |
| 71 | + |
| 72 | +// return cluster; |
| 73 | +// } |
0 commit comments