Package ai.djl.translate
Interface Batchifier
-
- All Known Implementing Classes:
PaddingStackBatchifier
,StackBatchifier
public interface Batchifier
An interface that provides methods to convert an un-batchedNDList
into a batchedNDList
and vice versa.Different implementations of
Batchifier
represent different ways of creating batches. The most common would be theStackBatchifier
that batchifies by creating a new batch axis as axis 0. Another implementation could be a concatenated batchifier for sequence elements that will concatenate the data elements along the time axis.
-
-
Field Summary
Fields Modifier and Type Field Description static Batchifier
STACK
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description NDList
batchify(NDList[] inputs)
Converts an array ofNDList
into an NDList.static Batchifier
fromString(java.lang.String name)
Returns a batchifier from a batchifier name.default NDList[]
split(NDList list, int numOfSlices, boolean evenSplit)
Splits the givenNDList
into the given number of slices.NDList[]
unbatchify(NDList inputs)
Reverses thebatchify
operation.
-
-
-
Field Detail
-
STACK
static final Batchifier STACK
-
-
Method Detail
-
fromString
static Batchifier fromString(java.lang.String name)
Returns a batchifier from a batchifier name.- Parameters:
name
- the batchifier name- Returns:
- the batchifier with the given name
- Throws:
java.lang.IllegalArgumentException
- if an invalid name is given
-
unbatchify
NDList[] unbatchify(NDList inputs)
Reverses thebatchify
operation.- Parameters:
inputs
- theNDList
that needs to be 'unbatchified'- Returns:
- an array of NDLists, of size equal to batch size, where each NDList is one element from the batch of inputs
-
-