Skip to main content

Module tensor_transaction

Module tensor_transaction 

Source
Expand description

Bounded, owned tensor capture and transactional mutation during decode.

A TensorTransactions value is moved into LlamaContextParams::with_tensor_transactions. The resulting crate::LlamaContext owns the callback state for its complete native lifetime. Matching tensors are synchronized by llama.cpp, copied into Rust-owned storage, and optionally transformed. Mutable tensors are written back exactly once only after the handler returns successfully and every output value passes validation.

Structs§

TensorBatchRow
Exact sequence and causal-position metadata for one tensor row.
TensorCallbackFailure
Contained callback failure returned by crate::LlamaContext::decode.
TensorSelector
Exact bounded graph-node contract.
TensorShape
Validated tensor dimensions.
TensorTransaction
One owned tensor transaction presented synchronously to Rust.
TensorTransactionError
Error returned by a tensor transaction handler or selector validator.
TensorTransactions
Owned, bounded callback program attached to one context.
TransactionalTensorCapture
Complete retained typed tensor from one callback invocation.

Enums§

CapturedTensorData
Typed retained tensor storage.
TensorAccess
Native access granted to one selected tensor.
TensorDataMut
Typed Rust-owned tensor storage supplied to a callback.
TensorElementType
Element representation required by an exact tensor selector.
TensorFiniteValidation
How aggressively a selector validates that f32 values are finite.
TensorRowMapping
Mapping between tensor rows and the submitted decode batch.
TensorWriteback
Native write-back decision returned by a transaction handler.

Constants§

MAX_RETAINED_TENSOR_BYTES
Maximum retained tensor bytes from one decode.
MAX_TENSOR_ELEMENTS
Maximum elements copied by one selected tensor invocation.
MAX_TENSOR_FAILURE_BYTES
Maximum retained callback failure bytes.
MAX_TENSOR_NAME_BYTES
Maximum UTF-8 bytes in one exact graph-node name.
MAX_TENSOR_ROWS
Maximum rows accepted from one selected tensor invocation.
MAX_TENSOR_SELECTORS
Maximum exact graph selectors attached to one context.

Traits§

TensorTransactionHandler
Synchronous safe handler for selected tensor transactions.