vision.cpp 610 Bytes
Newer Older
1
2
#include "vision.h"

3
#include <torch/library.h>
4
5
6
7

#ifdef WITH_CUDA
#include <cuda.h>
#endif
8
9
10
#ifdef WITH_HIP
#include <hip/hip_runtime.h>
#endif
11
12

// If we are in a Windows environment, we need to define
limm's avatar
limm committed
13
14
15
16
// initialization functions for the _custom_ops extension.
#if !defined(MOBILE) && defined(_WIN32)
void* PyInit__C(void) {
  return nullptr;
17
}
limm's avatar
limm committed
18
#endif // !defined(MOBILE) && defined(_WIN32)
19

20
namespace vision {
21
int64_t cuda_version() {
22
#ifdef WITH_CUDA
23
24
25
  return CUDA_VERSION;
#else
  return -1;
26
#endif
27
}
28

29
30
TORCH_LIBRARY_FRAGMENT(torchvision, m) {
  m.def("_cuda_version", &cuda_version);
31
}
32
} // namespace vision