mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Fixes #144302 Try to expose several APIs to public for privateuse1 scenario. Pull Request resolved: https://github.com/pytorch/pytorch/pull/144525 Approved by: https://github.com/cyyever, https://github.com/albanD
29 lines
643 B
C++
29 lines
643 B
C++
#include <c10/macros/Macros.h>
|
|
#include <torch/csrc/utils/object_ptr.h>
|
|
|
|
#include <torch/csrc/python_headers.h>
|
|
|
|
template <>
|
|
TORCH_PYTHON_API void THPPointer<PyObject>::free() {
|
|
if (ptr && C10_LIKELY(Py_IsInitialized()))
|
|
Py_DECREF(ptr);
|
|
}
|
|
|
|
template class THPPointer<PyObject>;
|
|
|
|
template <>
|
|
TORCH_PYTHON_API void THPPointer<PyCodeObject>::free() {
|
|
if (ptr && C10_LIKELY(Py_IsInitialized()))
|
|
Py_DECREF(ptr);
|
|
}
|
|
|
|
template class THPPointer<PyCodeObject>;
|
|
|
|
template <>
|
|
TORCH_PYTHON_API void THPPointer<PyFrameObject>::free() {
|
|
if (ptr && C10_LIKELY(Py_IsInitialized()))
|
|
Py_DECREF(ptr);
|
|
}
|
|
|
|
template class THPPointer<PyFrameObject>;
|