loop.cpp 324 Bytes
Newer Older
rusty1s's avatar
new try  
rusty1s committed
1
2
#ifndef LOOP_INC
#define LOOP_INC
rusty1s's avatar
rusty1s committed
3
4
5
6
7
8
9
10

#include <torch/torch.h>

inline std::tuple<at::Tensor, at::Tensor> remove_self_loops(at::Tensor row,
                                                            at::Tensor col) {
  auto mask = row != col;
  return {row.masked_select(mask), col.masked_select(mask)};
}
rusty1s's avatar
new try  
rusty1s committed
11
12

#endif // LOOP_INC