public abstract class BatchTensorList extends Object
It is a struct consisting of NDArrays, whose first dimension is batch, and also contains sequence dimension (whose position in tensor's shape is specified by seqDimOrder). The SeqBatcher batch operations will operate on these two dimensions.
| 限定符和类型 | 方法和说明 |
|---|---|
abstract BatchTensorList |
fromList(ai.djl.ndarray.NDList inputList,
long[] seqDimOrder)
Constructs a new
BatchTensorList instance from the serialized version of the batch
tensors. |
abstract ai.djl.ndarray.NDList |
getList()
Returns the serialized version of the BatchTensorList.
|
ai.djl.ndarray.NDArray |
getPastAttentionMask()
Returns the value of the pastAttentionMask.
|
ai.djl.ndarray.NDList |
getPastKeyValues()
Returns the value of the pastKeyValues.
|
ai.djl.ndarray.NDArray |
getPastOutputIds()
Returns the value of the pastOutputIds.
|
long[] |
getSeqDimOrder()
Returns the sequence dimension order which specifies where the sequence dimension is in a
tensor's shape.
|
void |
setPastAttentionMask(ai.djl.ndarray.NDArray pastAttentionMask)
Sets the attention mask.
|
void |
setPastKeyValues(ai.djl.ndarray.NDList pastKeyValues)
Sets the kv cache.
|
void |
setPastOutputIds(ai.djl.ndarray.NDArray pastOutputIds)
Sets the past output token ids.
|
void |
setSeqDimOrder(long[] seqDimOrder)
Sets the sequence dimension order which specifies where the sequence dimension is in a
tensor's shape.
|
public abstract BatchTensorList fromList(ai.djl.ndarray.NDList inputList, long[] seqDimOrder)
BatchTensorList instance from the serialized version of the batch
tensors.
The pastOutputIds has to be the first in the output list.
inputList - the serialized version of the batch tensorsseqDimOrder - the sequence dimension order that specifies where the sequence dimension
is in a tensor's shapepublic abstract ai.djl.ndarray.NDList getList()
public long[] getSeqDimOrder()
public ai.djl.ndarray.NDArray getPastOutputIds()
public void setPastOutputIds(ai.djl.ndarray.NDArray pastOutputIds)
pastOutputIds - the past output token idspublic ai.djl.ndarray.NDArray getPastAttentionMask()
public void setPastAttentionMask(ai.djl.ndarray.NDArray pastAttentionMask)
pastAttentionMask - the attention maskpublic ai.djl.ndarray.NDList getPastKeyValues()
public void setPastKeyValues(ai.djl.ndarray.NDList pastKeyValues)
pastKeyValues - the kv cachepublic void setSeqDimOrder(long[] seqDimOrder)
seqDimOrder - the sequence dimension order which specifies where the sequence dimension
is in a tensor's shapeCopyright © 2025. All rights reserved.