mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
This reverts commit 4f93de8951.
Reverted https://github.com/pytorch/pytorch/pull/136899 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](https://github.com/pytorch/pytorch/pull/136899#issuecomment-2392721534))
34 lines
728 B
C++
34 lines
728 B
C++
#include <torch/csrc/dynamo/utils.h>
|
|
|
|
namespace torch::dynamo {
|
|
|
|
static std::array<PyMethodDef, 1> _methods = {{
|
|
{nullptr,
|
|
nullptr,
|
|
0,
|
|
nullptr} // Sentinel value indicating the end of the array
|
|
}};
|
|
|
|
bool is_instancemethod(py::object obj) {
|
|
return PyInstanceMethod_Check(obj.ptr());
|
|
}
|
|
|
|
static struct PyModuleDef _module = {
|
|
PyModuleDef_HEAD_INIT,
|
|
"torch._C._dynamo.utils",
|
|
"Module containing C utils",
|
|
-1,
|
|
_methods.data()};
|
|
|
|
PyObject* torch_c_dynamo_utils_init() {
|
|
auto m = PyModule_Create(&_module);
|
|
if (m == nullptr)
|
|
return nullptr;
|
|
|
|
auto py_m = py::handle(m).cast<py::module>();
|
|
py_m.def("is_instancemethod", is_instancemethod);
|
|
return m;
|
|
}
|
|
|
|
} // namespace torch::dynamo
|