mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Remove `THPWrapper` from PyTorch C code since it is not used anymore and because we have dropped Python 2 compatibility, its usage can be replaced by capsule objects (`PyCapsule_New`, `PyCapsule_CheckExact`, `PyCapsule_GetPointer` and `PyCapsule_GetDestructor`. Pull Request resolved: https://github.com/pytorch/pytorch/pull/49871 Reviewed By: mruberry Differential Revision: D25715038 Pulled By: albanD fbshipit-source-id: cc3b6f967bbe0dc42c692adf76dff4e4b667fdd5
45 lines
1.3 KiB
C
45 lines
1.3 KiB
C
#ifndef THP_H
|
|
#define THP_H
|
|
|
|
#include <torch/csrc/python_headers.h>
|
|
#include <TH/TH.h>
|
|
#include <TH/THTensor.hpp>
|
|
|
|
#include <torch/csrc/THP_export.h>
|
|
|
|
// Back-compatibility macros, Thanks to http://cx-oracle.sourceforge.net/
|
|
// define PyInt_* macros for Python 3.x. NB: We must include Python.h first,
|
|
// otherwise we'll incorrectly conclude PyInt_Check isn't defined!
|
|
#ifndef PyInt_Check
|
|
#define PyInt_Check PyLong_Check
|
|
#define PyInt_FromLong PyLong_FromLong
|
|
#define PyInt_AsLong PyLong_AsLong
|
|
#define PyInt_Type PyLong_Type
|
|
#endif
|
|
|
|
// By default, don't specify library state (TH doesn't use one)
|
|
#define LIBRARY_STATE
|
|
#define LIBRARY_STATE_NOARGS
|
|
#define LIBRARY_STATE_TYPE
|
|
#define LIBRARY_STATE_TYPE_NOARGS
|
|
|
|
#define THWStorage THStorage
|
|
#define THWStorage_(NAME) THStorage_(NAME)
|
|
#define THWTensor THTensor
|
|
#define THWTensor_(NAME) THTensor_(NAME)
|
|
|
|
#include <torch/csrc/Exceptions.h>
|
|
#include <torch/csrc/Generator.h>
|
|
#include <torch/csrc/Module.h>
|
|
#include <torch/csrc/Size.h>
|
|
#include <torch/csrc/Storage.h>
|
|
#include <torch/csrc/Types.h>
|
|
#include <torch/csrc/utils.h> // This requires defined Storage and Tensor types
|
|
#include <torch/csrc/utils/byte_order.h>
|
|
|
|
#include <torch/csrc/serialization.h>
|
|
|
|
#include <torch/csrc/autograd/python_autograd.h>
|
|
|
|
#endif
|