You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't quite understand the logic of using PyBlobWrap, can someone explain to me please?
// We need another wrapper (used as boost::python's HeldType) that receives a
// self PyObject * which we can use as ndarray.base, so that data/diff memory
// is not freed while still being used in Python.
class PyBlobWrap : public PyBlob {
public:
PyBlobWrap(PyObject *p, const PyBlob &blob)
: PyBlob(blob), self_(p) {}
bp::object get_data();
bp::object get_diff();
private:
PyObject *self_;
};
The text was updated successfully, but these errors were encountered:
Python and Caffe have to share memory. Instead of doing pointless copies that cost memory, the Caffe blob and Python ndarray share the same pointer to host memory. The PyBlob wrapper keeps Caffe from de-allocating a blob memory if its still in use on the Python side.
I don't quite understand the logic of using PyBlobWrap, can someone explain to me please?
// We need another wrapper (used as boost::python's HeldType) that receives a
// self PyObject * which we can use as ndarray.base, so that data/diff memory
// is not freed while still being used in Python.
class PyBlobWrap : public PyBlob {
public:
PyBlobWrap(PyObject *p, const PyBlob &blob)
: PyBlob(blob), self_(p) {}
bp::object get_data();
bp::object get_diff();
private:
PyObject *self_;
};
The text was updated successfully, but these errors were encountered: