LMCache Memory Object#

class MemoryObj[source]#

MemoryObj interface.

abstract property byte_array: bytes#

Get the byte array from the MemoryObj.

get_dtype() dtype | None[source]#

Get the dtype of the MemoryObj.

abstract get_memory_format() MemoryFormat[source]#

Get the memory format of the MemoryObj.

abstract get_physical_size() int[source]#

Get the physical size of the MemoryObj in bytes.

abstract get_shape() Size[source]#

Get the shape of the MemoryObj.

abstract get_size() int[source]#

Get the size of the MemoryObj in bytes.

abstract invalidate()[source]#

Invalidate the MemoryObj.

abstract is_valid()[source]#

Check if the MemoryObj is valid.

abstract property metadata: MemoryObjMetadata#

Get the metada of the MemoryObj.

abstract property tensor: Tensor | None#

Get the tensor from the MemoryObj.

class MemoryFormat(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

BINARY = 2#
BINARY_BUFFER = 3#
KV_BLOB = 1#

Compressed binary array format

UNDEFINED = 0#

[2, num_layers, num_tokens, hidden_dim]

token_dim() int[source]#