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

3
#ifndef MOBILE
4
#include <Python.h>
5
#endif
6
#include <torch/library.h>
7
8
9
10

#ifdef WITH_CUDA
#include <cuda.h>
#endif
11
12
13
#ifdef WITH_HIP
#include <hip/hip_runtime.h>
#endif
14
15

// If we are in a Windows environment, we need to define
16
// initialization functions for the _custom_ops extension
17
#ifdef _WIN32
18
PyMODINIT_FUNC PyInit__C(void) {
19
20
21
22
  // No need to do anything.
  return NULL;
}
#endif
23

24
namespace vision {
25
int64_t cuda_version() {
26
#ifdef WITH_CUDA
27
28
29
  return CUDA_VERSION;
#else
  return -1;
30
#endif
31
}
32

33
34
TORCH_LIBRARY_FRAGMENT(torchvision, m) {
  m.def("_cuda_version", &cuda_version);
35
}
36
} // namespace vision