mixle.stats.compute.encoded moduleΒΆ

Metadata wrapper for sequence-encoded data batches.

class EncodedData(count, payload, engine, nbytes, encoder=None)[source]

Bases: object

A one-chunk encoded payload with planner-visible metadata.

Parameters:
  • count (int)

  • payload (Any)

  • engine (ComputeEngine)

  • nbytes (int)

  • encoder (DataSequenceEncoder | None)

count: int
payload: Any
engine: ComputeEngine
nbytes: int
encoder: DataSequenceEncoder | None = None
classmethod from_payload(payload, count, encoder=None, engine=None)[source]

Wrap an already encoded payload with count, engine, and byte metadata.

Parameters:
  • payload (Any)

  • count (int)

  • encoder (DataSequenceEncoder | None)

  • engine (ComputeEngine | None)

Return type:

EncodedData

classmethod from_data(data, encoder, engine=None)[source]

Encode raw data once and attach planner-visible metadata.

Parameters:
  • data (Any)

  • encoder (DataSequenceEncoder)

  • engine (ComputeEngine | None)

Return type:

EncodedData

as_seq_chunk()[source]

Return the legacy (count, encoded_payload) chunk tuple.

Return type:

tuple[int, Any]

class ResidentEncodedPayload(host_payload, engine_payload)[source]

Bases: object

Pair a host encoding with a resident engine encoding for one chunk.

Parameters:
  • host_payload (Any)

  • engine_payload (Any)

host_payload: Any
engine_payload: Any
as_encoded_data(payload, count, encoder=None, engine=None)[source]

Wrap an existing encoded payload with count, engine, and byte metadata.

Parameters:
  • payload (Any)

  • count (int)

  • encoder (DataSequenceEncoder | None)

  • engine (ComputeEngine | None)

Return type:

EncodedData

move_encoded_payload(payload, engine)[source]

Move numeric encoded arrays into engine while preserving object fields.

Encoders remain backend-agnostic and produce their historical Python/NumPy payloads. Orchestrators can call this exactly once after encoding a shard so scoring kernels see resident engine arrays. Object/string arrays and non-array Python metadata stay on the host because many distribution encodings intentionally carry labels, maps, or structural metadata.

Parameters:
  • payload (Any)

  • engine (ComputeEngine)

Return type:

Any