Skip to content

buffer ๐Ÿ”—

Interface to the struct vaccel_torch_buffer C object.

Buffer ๐Ÿ”—

Buffer(data: bytes | bytearray)

Bases: CType

Wrapper for the struct vaccel_torch_buffer C object.

Manages the creation and initialization of a C struct vaccel_torch_buffer and provides access to it through Python properties.

Inherits

CType: Abstract base class for defining C data types.

Parameters:

Name Type Description Default

data ๐Ÿ”—

bytes | bytearray

The buffer data to be passed to the C struct.

required
Source code in vaccel/ops/torch/buffer.py
def __init__(self, data: bytes | bytearray):
    """Initializes a new `Buffer` object.

    Args:
        data: The buffer data to be passed to the C struct.
    """
    self._data = data
    self._c_data = None
    self._c_obj_ptr = ffi.NULL
    super().__init__()

c_size property ๐Ÿ”—

c_size: int

Returns the size of the object in bytes.

data property ๐Ÿ”—

data: bytes

The buffer data.

Returns:

Type Description
bytes

The data of the buffer.

size property ๐Ÿ”—

size: int

The buffer size.

Returns:

Type Description
int

The size of the buffer.

value property ๐Ÿ”—

value: CData

Returns the value of the underlying C struct.

Returns:

Type Description
CData

The dereferenced 'struct vaccel_torch_buffer`