tvm
|
A class that wraps a Python object and preserves its ownership. More...
#include <registry.h>
Public Member Functions | |
WrappedPythonObject () | |
Construct a wrapper that doesn't own anything. More... | |
WrappedPythonObject (std::nullptr_t) | |
Conversion constructor from nullptr. More... | |
WrappedPythonObject (void *python_obj) | |
Take ownership of a python object. More... | |
~WrappedPythonObject () | |
Drop ownership of a python object. More... | |
WrappedPythonObject (WrappedPythonObject &&) | |
WrappedPythonObject & | operator= (WrappedPythonObject &&) |
WrappedPythonObject (const WrappedPythonObject &) | |
WrappedPythonObject & | operator= (const WrappedPythonObject &) |
WrappedPythonObject & | operator= (std::nullptr_t) |
operator bool () | |
void * | raw_pointer () |
A class that wraps a Python object and preserves its ownership.
This class is used to wrap a PyObject* from the Python API and preserve its ownership. Allows for the creation of strong references to Python objects, which prevent them from being garbage-collected as long as the wrapper object exists.
|
inline |
Construct a wrapper that doesn't own anything.
|
inlineexplicit |
Conversion constructor from nullptr.
|
explicit |
Take ownership of a python object.
A new strong reference is created for the underlying python object.
python_obj | A PyObject* from the Python.h API. A new strong reference is created using Py_IncRef. |
tvm::runtime::WrappedPythonObject::~WrappedPythonObject | ( | ) |
Drop ownership of a python object.
Removes the strong reference held by the wrapper.
tvm::runtime::WrappedPythonObject::WrappedPythonObject | ( | WrappedPythonObject && | ) |
tvm::runtime::WrappedPythonObject::WrappedPythonObject | ( | const WrappedPythonObject & | ) |
|
inline |
WrappedPythonObject& tvm::runtime::WrappedPythonObject::operator= | ( | const WrappedPythonObject & | ) |
WrappedPythonObject& tvm::runtime::WrappedPythonObject::operator= | ( | std::nullptr_t | ) |
WrappedPythonObject& tvm::runtime::WrappedPythonObject::operator= | ( | WrappedPythonObject && | ) |
|
inline |