LLamaTokenDataArray
Namespace: LLama.Native
Contains an array of LLamaTokenData, potentially sorted.
1 |
|
Inheritance Object → ValueType → LLamaTokenDataArray
Fields
Data
The LLamaTokenData
1 |
|
Sorted
Indicates if data
is sorted by logits in descending order. If this is false the token data is in no particular order.
1 |
|
Constructors
LLamaTokenDataArray(Memory<LLamaTokenData>, Boolean)
Create a new LLamaTokenDataArray
1 |
|
Parameters
tokens
Memory<LLamaTokenData>
isSorted
Boolean
Methods
Create(ReadOnlySpan<Single>)
Create a new LLamaTokenDataArray, copying the data from the given logits
1 |
|
Parameters
logits
ReadOnlySpan<Single>
Returns
Create(ReadOnlySpan<Single>, Memory<LLamaTokenData>)
Create a new LLamaTokenDataArray, copying the data from the given logits into temporary memory.
1 |
|
Parameters
logits
ReadOnlySpan<Single>
buffer
Memory<LLamaTokenData>
Temporary memory which will be used to work on these logits. Must be at least as large as logits array
Returns
Remarks:
The memory must not be modified while this LLamaTokenDataArray is in use.
OverwriteLogits(ReadOnlySpan<ValueTuple<LLamaToken, Single>>)
Overwrite the logit values for all given tokens
1 |
|
Parameters
values
ReadOnlySpan<ValueTuple<LLamaToken, Single>>
tuples of token and logit value to overwrite
Softmax()
Sorts candidate tokens by their logits in descending order and calculate probabilities based on logits.
1 |
|