Files
pytorch/torch/csrc/utils/object_ptr.cpp
dilililiwhy 7c52c97a65 Expose several APIs to public (torch python APIs) (#144525)
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
2025-01-15 14:34:45 +00:00

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>;