LLamaBatchEmbeddings
Namespace: LLama.Native
An embeddings batch allows submitting embeddings to multiple sequences simultaneously
1 |
|
Inheritance Object → LLamaBatchEmbeddings
Attributes NullableContextAttribute, NullableAttribute
Properties
EmbeddingDimensions
Size of an individual embedding
1 |
|
Property Value
EmbeddingsCount
The number of items in this batch
1 |
|
Property Value
SequenceCapacity
Maximum number of sequences an item can be assigned to (automatically grows if exceeded)
1 |
|
Property Value
Constructors
LLamaBatchEmbeddings(Int32)
Create a new batch for submitting inputs to llama.cpp
1 |
|
Parameters
embeddingDimensions
Int32
Methods
Add(ReadOnlySpan<Single>, LLamaPos, ReadOnlySpan<LLamaSeqId>, Boolean)
Add a single embedding to the batch at the same position in several sequences
1 |
|
Parameters
embedding
ReadOnlySpan<Single>
The embedding to add
pos
LLamaPos
The position to add it att
sequences
ReadOnlySpan<LLamaSeqId>
The set of sequences to add this token to
logits
Boolean
Returns
Int32
The index that the token was added at. Use this for GetLogitsIth
Remarks:
Add(ReadOnlySpan<Single>, LLamaPos, LLamaSeqId, Boolean)
Add a single embedding to the batch for a single sequence
1 |
|
Parameters
embedding
ReadOnlySpan<Single>
pos
LLamaPos
sequence
LLamaSeqId
logits
Boolean
Returns
Int32
The index that the token was added at. Use this for GetLogitsIth
Add<TParam>(TParam, WriteEmbeddingsDelegate<TParam>, LLamaPos, ReadOnlySpan<LLamaSeqId>, Boolean)
Add a single embedding to the batch at the same position in several sequences
1 |
|
Type Parameters
TParam
Type of userdata passed to write delegate
Parameters
parameter
TParam
Userdata passed to write delegate
write
WriteEmbeddingsDelegate<TParam>
Delegate called once to write data into a span
pos
LLamaPos
Position to write this embedding to
sequences
ReadOnlySpan<LLamaSeqId>
All sequences to assign this embedding to
logits
Boolean
Whether logits should be generated for this embedding
Returns
Int32
The index that the token was added at. Use this for GetLogitsIth
Remarks:
Add<TParam>(TParam, WriteEmbeddingsDelegate<TParam>, LLamaPos, LLamaSeqId, Boolean)
Add a single embedding to the batch at a position for one sequence
1 |
|
Type Parameters
TParam
Type of userdata passed to write delegate
Parameters
parameter
TParam
Userdata passed to write delegate
write
WriteEmbeddingsDelegate<TParam>
Delegate called once to write data into a span
pos
LLamaPos
Position to write this embedding to
sequence
LLamaSeqId
Sequence to assign this embedding to
logits
Boolean
Whether logits should be generated for this embedding
Returns
Int32
The index that the token was added at. Use this for GetLogitsIth
Remarks:
Clear()
Set EmbeddingsCount to zero for this batch
1 |
|