File tree 7 files changed +3
-50
lines changed
7 files changed +3
-50
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ option(WITH_CUDA "Enable CUDA support" OFF)
7
7
option (WITH_MPS "Enable MPS support" OFF )
8
8
option (WITH_PNG "Enable features requiring LibPNG." ON )
9
9
option (WITH_JPEG "Enable features requiring LibJPEG." ON )
10
- option (USE_PYTHON "Link to Python when building" OFF )
11
10
12
11
if (WITH_CUDA)
13
12
enable_language (CUDA)
@@ -33,11 +32,6 @@ if (WITH_JPEG)
33
32
find_package (JPEG REQUIRED)
34
33
endif ()
35
34
36
- if (USE_PYTHON)
37
- add_definitions (-DUSE_PYTHON)
38
- find_package (Python3 REQUIRED COMPONENTS Development)
39
- endif ()
40
-
41
35
function (CUDA_CONVERT_FLAGS EXISTING_TARGET)
42
36
get_property (old_flags TARGET ${EXISTING_TARGET} PROPERTY INTERFACE_COMPILE_OPTIONS)
43
37
if (NOT "${old_flags} " STREQUAL "" )
@@ -110,10 +104,6 @@ if (WITH_JPEG)
110
104
target_link_libraries (${PROJECT_NAME} PRIVATE ${JPEG_LIBRARIES} )
111
105
endif ()
112
106
113
- if (USE_PYTHON)
114
- target_link_libraries (${PROJECT_NAME} PRIVATE Python3::Python)
115
- endif ()
116
-
117
107
set_target_properties (${PROJECT_NAME} PROPERTIES
118
108
EXPORT_NAME TorchVision
119
109
INSTALL_RPATH ${TORCH_INSTALL_PREFIX} /lib)
Original file line number Diff line number Diff line change @@ -46,13 +46,5 @@ if(@WITH_JPEG@)
46
46
target_compile_definitions (${PN} ::${PN} INTERFACE JPEG_FOUND)
47
47
endif ()
48
48
49
- if (@USE_PYTHON@)
50
- if (NOT TARGET Python3::Python)
51
- find_package (Python3 COMPONENTS Development)
52
- endif ()
53
- target_link_libraries (torch INTERFACE Python3::Python)
54
- target_compile_definitions (${PN} ::${PN} INTERFACE USE_PYTHON)
55
- endif ()
56
-
57
49
endif ()
58
50
endif ()
Original file line number Diff line number Diff line change @@ -81,9 +81,6 @@ cmake --install .
81
81
You may want to pass `-DCMAKE_INSTALL_PREFIX=/path/to/libtorchvision ` for
82
82
cmake to copy/install the files to a specific location (e.g. `$CONDA_PREFIX `).
83
83
84
- On Windows, you may also need to pass `-DUSE_PYTHON `. Refer to the corresponding
85
- `CMakeLists.txt ` for additional options.
86
-
87
84
**DISCLAIMER **: the `libtorchvision ` library includes the torchvision
88
85
custom ops as well as most of the C++ torchvision APIs. Those APIs do not come
89
86
with any backward-compatibility guarantees and may change from one version to
Original file line number Diff line number Diff line change @@ -209,7 +209,6 @@ def get_extensions():
209
209
210
210
if sys .platform == "win32" :
211
211
define_macros += [("torchvision_EXPORTS" , None )]
212
- define_macros += [("USE_PYTHON" , None )]
213
212
extra_compile_args ["cxx" ].append ("/MP" )
214
213
215
214
if debug_mode :
@@ -254,9 +253,6 @@ def get_extensions():
254
253
image_library = []
255
254
image_link_flags = []
256
255
257
- if sys .platform == "win32" :
258
- image_macros += [("USE_PYTHON" , None )]
259
-
260
256
# Locating libPNG
261
257
libpng = shutil .which ("libpng-config" )
262
258
pngfix = shutil .which ("pngfix" )
Original file line number Diff line number Diff line change 1
1
#include " image.h"
2
2
3
3
#include < ATen/core/op_registration/op_registration.h>
4
- #ifdef USE_PYTHON
5
- #include < Python.h>
6
- #endif
7
4
8
5
// If we are in a Windows environment, we need to define
9
6
// initialization functions for the _custom_ops extension
10
- #ifdef USE_PYTHON
11
7
#ifdef _WIN32
12
- PyMODINIT_FUNC PyInit_image (void ) {
13
- // No need to do anything.
8
+ void * PyInit_image (void ) {
14
9
return nullptr ;
15
10
}
16
11
#endif
17
- #endif // USE_PYTHON
18
12
19
13
namespace vision {
20
14
namespace image {
Original file line number Diff line number Diff line change 1
1
#include " video_reader.h"
2
2
3
- #ifdef USE_PYTHON
4
- #include < Python.h>
5
- #endif
6
-
7
3
#include " ../decoder/memory_buffer.h"
8
4
#include " ../decoder/sync_decoder.h"
9
5
10
- #ifdef USE_PYTHON
11
6
// If we are in a Windows environment, we need to define
12
7
// initialization functions for the _custom_ops extension
13
8
#ifdef _WIN32
14
- PyMODINIT_FUNC PyInit_video_reader (void ) {
15
- // No need to do anything.
9
+ void * PyInit_video_reader (void ) {
16
10
return nullptr ;
17
11
}
18
12
#endif
19
- #endif // USE_PYTHONs
20
13
21
14
using namespace ffmpeg ;
22
15
Original file line number Diff line number Diff line change 1
1
#include " vision.h"
2
2
3
- #ifndef MOBILE
4
- #ifdef USE_PYTHON
5
- #include < Python.h>
6
- #endif
7
- #endif
8
3
#include < torch/library.h>
9
4
10
5
#ifdef WITH_CUDA
16
11
17
12
// If we are in a Windows environment, we need to define
18
13
// initialization functions for the _custom_ops extension.
19
- // For PyMODINIT_FUNC to work, we need to include Python.h
20
14
#if !defined(MOBILE) && defined(_WIN32)
21
- #ifdef USE_PYTHON
22
- PyMODINIT_FUNC PyInit__C (void ) {
23
- // No need to do anything.
15
+ void * PyInit__C (void ) {
24
16
return nullptr ;
25
17
}
26
- #endif // USE_PYTHON
27
18
#endif // !defined(MOBILE) && defined(_WIN32)
28
19
29
20
namespace vision {
You can’t perform that action at this time.
0 commit comments