Classes | |
class | args |
class | bool_ |
class | buffer |
class | bytes |
class | capsule |
class | dict |
class | ellipsis |
class | float_ |
class | function |
class | int_ |
class | iterable |
class | iterator |
class | kwargs |
class | list |
class | memoryview |
class | none |
class | sequence |
class | set |
class | slice |
class | staticmethod |
class | str |
class | tuple |
class | type |
class | weakref |
Functions | |
template<typename Unsigned > | |
Unsigned | as_unsigned (PyObject *o) |
static memoryview | memoryview::from_buffer (void *ptr, ssize_t itemsize, const char *format, detail::any_container< ssize_t > shape, detail::any_container< ssize_t > strides, bool readonly=false) |
Unsigned as_unsigned | ( | PyObject * | o | ) |
|
inlinestatic |
Creates memoryview
from static buffer.
This method is meant for providing a memoryview
for C/C++ buffer not managed by Python. The caller is responsible for managing the lifetime of ptr
and format
, which MUST outlive the memoryview constructed here.
See also: Python C API documentation for PyMemoryView_FromBuffer
_.
.. _PyMemoryView_FromBuffer: https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromBuffer
:param ptr: Pointer to the buffer. :param itemsize: Byte size of an element. :param format: Pointer to the null-terminated format string. For homogeneous Buffers, this should be set to format_descriptor<T>::value
. :param shape: Shape of the tensor (1 entry per dimension). :param strides: Number of bytes between adjacent entries (for each per dimension). :param readonly: Flag to indicate if the underlying storage may be written to.