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 <c10/util/Logging.h>
#include <torch/script.h>
......@@ -9,22 +8,6 @@
using namespace std;
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 AVPixelFormat defaultVideoPixelFormat = AV_PIX_FMT_RGB24;
const AVSampleFormat defaultAudioSampleFormat = AV_SAMPLE_FMT_FLT;
......
......@@ -6,7 +6,6 @@
#include <vector>
#include <ATen/ATen.h>
#include <Python.h>
#include <c10/util/Logging.h>
#include <torch/script.h>
......
......@@ -12,18 +12,11 @@ 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
namespace video_reader {
......
......@@ -2,8 +2,6 @@
// All pure C++ headers for the C++ frontend.
#include <torch/all.h>
// Python bindings for the C++ frontend (includes Python.h).
#include <torch/python.h>
class NewEmptyTensorOp : public torch::autograd::Function<NewEmptyTensorOp> {
public:
......
......@@ -17,22 +17,13 @@
#include "nms.h"
// 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
#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) {
// No need to do anything.
// extension.py will run on load
return NULL;
}
#endif
#endif
namespace vision {
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