vertebrae.utils.embedding_batches

Deterministic batching helpers shared by endpoint embedding workflows.

Functions

endpoint_n_rows(values)

Return aligned endpoint row count for common input containers.

take_endpoint_rows(values, indices)

Select endpoint rows while preserving common container types.

iter_endpoint_batches(values, batch_size)

Yield deterministic contiguous endpoint batches.

encode_endpoint_batches(values, *, batch_size, encode, ...)

Encode and combine deterministic endpoint batches without sparse densification.

Module Contents

vertebrae.utils.embedding_batches.endpoint_n_rows(values)[source]

Return aligned endpoint row count for common input containers.

Parameters:

values (Any)

Return type:

int

vertebrae.utils.embedding_batches.take_endpoint_rows(values, indices)[source]

Select endpoint rows while preserving common container types.

Parameters:
  • values (Any)

  • indices (numpy.ndarray)

Return type:

Any

vertebrae.utils.embedding_batches.iter_endpoint_batches(values, batch_size)[source]

Yield deterministic contiguous endpoint batches.

Parameters:
  • values (Any)

  • batch_size (int)

Return type:

Iterator[Tuple[numpy.ndarray, Any]]

vertebrae.utils.embedding_batches.encode_endpoint_batches(values, *, batch_size, encode, owner, profiler=None, call_type='encode_endpoint', memory_config=None)[source]

Encode and combine deterministic endpoint batches without sparse densification.

Encoded rows and their final ordering references are admitted progressively through shared matrix and metadata stagers. No-spill runs fail as soon as retaining the next row or reference would cross the configured budget; spill-enabled runs write both to temporary storage immediately. Omitting memory_config uses the default memory policy.

Parameters:
  • values (Any)

  • batch_size (int)

  • encode (Callable[[Any], Any])

  • owner (str)

  • profiler (Any)

  • call_type (str)

  • memory_config (Optional[vertebrae.config.MemoryConfig])

Return type:

Any