"git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "fe4d17fc43e9e0674d741712a68fceba620c2c8f"
Unverified Commit d6102173 authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

[PyTorch] Fix windows build for torchvision when `MOBILE` is defined (#4571) (#4742)

Summary:
Pull Request resolved: https://github.com/pytorch/vision/pull/4571



Fixing windows build for `torchvision` when `MOBILE` is defined. In `csrc/vision.cpp`, since `PyMODINIT_FUNC` depends on `Python.h` I added the same condition for `PyMODINIT_FUNC` as the one for `import <PyTorch.h>`.

Reviewed By: malfet

Differential Revision: D31488734

fbshipit-source-id: fd52a9ab161288d9c8bf3b9e0ab9da856a4ebadb
Co-authored-by: default avatarMengwei Liu <larryliu@fb.com>
parent 7839bdbe
...@@ -13,13 +13,14 @@ ...@@ -13,13 +13,14 @@
#endif #endif
// 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 // For PyMODINIT_FUNC to work, we need to include Python.h
#if !defined(MOBILE) && defined(_WIN32)
PyMODINIT_FUNC PyInit__C(void) { PyMODINIT_FUNC PyInit__C(void) {
// No need to do anything. // No need to do anything.
return NULL; return NULL;
} }
#endif #endif // !defined(MOBILE) && defined(_WIN32)
namespace vision { namespace vision {
int64_t cuda_version() { int64_t cuda_version() {
......
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