Method EncodeBatch
- Namespace
- Qavren.Edge.Embeddings.Onnx
- Assembly
- Qavren.Edge.Embeddings.Onnx.dll
EncodeBatch(IReadOnlyList<string>, int, IReadOnlyList<int>)
Encodes, truncates, right-pads to the smallest configured bucket that fits the batch maximum, and synthesises the attention mask.
The returned batch's three long[] are rented from
ArrayPool<T>.Shared and are valid over their first
Qavren.Edge.Embeddings.Onnx.TokenizedBatch.TensorLength elements only. The generator hands them back once
the OrtValues built over them are disposed; a caller outside this package simply
drops the batch and the GC reclaims the buffers without them ever re-entering the pool.
TokenizedBatch EncodeBatch(IReadOnlyList<string> texts, int maxSequenceLength, IReadOnlyList<int> buckets)
Parameters
textsIReadOnlyList<string>The inputs, already prefixed by the caller.
maxSequenceLengthintThe preset's ceiling.
bucketsIReadOnlyList<int>The preset's sequence buckets, ascending.
Returns
- TokenizedBatch
One padded batch.