fhelium.serialization.value
Exact typed value envelopes, validation, and reconstruction.
VALUE_SCHEMA_VERSION
constant View source
VALUE_SCHEMA_VERSION = 2ValueEnvelope
class View source
ValueEnvelope(schema_version: int, value_type: str, context_id: str | None, metadata: dict[str, Any], tensors: dict[str, torch.Tensor])An exact value description with tensors but no path or store policy.
The envelope is the shared representation for application-owned storage and memory managers. Its tensors may be moved or persisted by the caller, then passed to to_value to reconstruct the exact FHElium value type.
Attributes
| Name | Type | Default/value |
|---|---|---|
schema_version | int | |
value_type | str | |
context_id | str | None | |
metadata | dict[str, Any] | |
tensors | dict[str, torch.Tensor] |
from_value
method
def from_value(value: TensorResident) -> Self: ...Describe one exact live value without choosing storage policy.
to_value
method
def to_value() -> TensorResident: ...Reconstruct the exact concrete FHElium value type.
nbytes
property
nbytes: intsupported_value_types
function View source
def supported_value_types() -> tuple[str, ...]: ...validate_value_description
function View source
def validate_value_description(*, schema_version: object, value_type: object, context_id: object, metadata: object, tensor_names: set[str], tensor_metadata: dict[str, Any] | None=None) -> None: ...Validate an exact tensor-free value schema description.
Persistence inspection and envelope materialization share this validator, so stale metadata and tensor-name mismatches fail before payload loading.