| 39 | namespace py = pybind11; |
| 40 | |
| 41 | static void DLPack_Capsule_Destructor(PyObject *data) { |
| 42 | auto *dlMTensor = (DLManagedTensor *)PyCapsule_GetPointer(data, "dltensor"); |
| 43 | if (dlMTensor) { |
| 44 | // the dlMTensor has not been consumed, call deleter ourselves |
| 45 | // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) |
| 46 | dlMTensor->deleter(const_cast<DLManagedTensor *>(dlMTensor)); |
| 47 | } else { |
| 48 | // the dlMTensor has been consumed |
| 49 | // PyCapsule_GetPointer has set an error indicator |
| 50 | PyErr_Clear(); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | static void BindConfig(py::module &m) { |
| 55 | py::enum_<core::BlasProvider>(m, "BlasProvider") |
nothing calls this directly
no outgoing calls
no test coverage detected