Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions torchvision/csrc/cpu/video/Video.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#include "Video.h"
#include <c10/util/Logging.h>
#include <torch/script.h>
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion torchvision/csrc/cpu/video/Video.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <vector>

#include <ATen/ATen.h>
#include <Python.h>
#include <c10/util/Logging.h>
#include <torch/script.h>

Expand Down
7 changes: 0 additions & 7 deletions torchvision/csrc/cpu/video_reader/VideoReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 0 additions & 2 deletions torchvision/csrc/empty_tensor_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 1 addition & 10 deletions torchvision/csrc/vision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down