Unverified Commit 4fcf11d8 authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

Removing python headers and Win32 Python2 inits in C++ (#3011)

* Removing python headers and code for Python2 compatibility.

* Restoring python3 inits.
parent 76ebe92d
#include "Video.h" #include "Video.h"
#include <c10/util/Logging.h> #include <c10/util/Logging.h>
#include <torch/script.h> #include <torch/script.h>
...@@ -9,22 +8,6 @@ ...@@ -9,22 +8,6 @@
using namespace std; using namespace std;
using namespace ffmpeg; using namespace ffmpeg;
// If we are in a Windows environment, we need to define
// initialization functions for the _custom_ops extension
// #ifdef _WIN32
// #if PY_MAJOR_VERSION < 3
// PyMODINIT_FUNC init_video_reader(void) {
// // No need to do anything.
// return NULL;
// }
// #else
// PyMODINIT_FUNC PyInit_video_reader(void) {
// // No need to do anything.
// return NULL;
// }
// #endif
// #endif
const size_t decoderTimeoutMs = 600000; const size_t decoderTimeoutMs = 600000;
const AVPixelFormat defaultVideoPixelFormat = AV_PIX_FMT_RGB24; const AVPixelFormat defaultVideoPixelFormat = AV_PIX_FMT_RGB24;
const AVSampleFormat defaultAudioSampleFormat = AV_SAMPLE_FMT_FLT; const AVSampleFormat defaultAudioSampleFormat = AV_SAMPLE_FMT_FLT;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <vector> #include <vector>
#include <ATen/ATen.h> #include <ATen/ATen.h>
#include <Python.h>
#include <c10/util/Logging.h> #include <c10/util/Logging.h>
#include <torch/script.h> #include <torch/script.h>
......
...@@ -12,18 +12,11 @@ using namespace ffmpeg; ...@@ -12,18 +12,11 @@ using namespace ffmpeg;
// If we are in a Windows environment, we need to define // If we are in a Windows environment, we need to define
// initialization functions for the _custom_ops extension // initialization functions for the _custom_ops extension
#ifdef _WIN32 #ifdef _WIN32
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_video_reader(void) {
// No need to do anything.
return NULL;
}
#else
PyMODINIT_FUNC PyInit_video_reader(void) { PyMODINIT_FUNC PyInit_video_reader(void) {
// No need to do anything. // No need to do anything.
return NULL; return NULL;
} }
#endif #endif
#endif
namespace video_reader { namespace video_reader {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// All pure C++ headers for the C++ frontend. // All pure C++ headers for the C++ frontend.
#include <torch/all.h> #include <torch/all.h>
// Python bindings for the C++ frontend (includes Python.h).
#include <torch/python.h>
class NewEmptyTensorOp : public torch::autograd::Function<NewEmptyTensorOp> { class NewEmptyTensorOp : public torch::autograd::Function<NewEmptyTensorOp> {
public: public:
......
...@@ -17,22 +17,13 @@ ...@@ -17,22 +17,13 @@
#include "nms.h" #include "nms.h"
// If we are in a Windows environment, we need to define // If we are in a Windows environment, we need to define
// initialization functions for the _C extension // initialization functions for the _custom_ops extension
#ifdef _WIN32 #ifdef _WIN32
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_C(void) {
// No need to do anything.
// extension.py will run on load
return NULL;
}
#else
PyMODINIT_FUNC PyInit__C(void) { PyMODINIT_FUNC PyInit__C(void) {
// No need to do anything. // No need to do anything.
// extension.py will run on load
return NULL; return NULL;
} }
#endif #endif
#endif
namespace vision { namespace vision {
int64_t cuda_version() noexcept { int64_t cuda_version() noexcept {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment