bincount.cpp 369 Bytes
Newer Older
limm's avatar
limm committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <torch/torch.h>

#define CHECK_CUDA(x) AT_ASSERTM(x.type().is_cuda(), #x " must be CUDA tensor")

at::Tensor bincount_cuda(at::Tensor src, int64_t size);

at::Tensor bincount(at::Tensor src, int64_t size) {
  CHECK_CUDA(src);
  return bincount_cuda(src, size);
}

PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
  m.def("bincount", &bincount, "BinCount (CUDA)");
}