Package ai.djl.translate
Class PaddingStackBatchifier.Builder
- java.lang.Object
-
- ai.djl.translate.PaddingStackBatchifier.Builder
-
- Enclosing class:
- PaddingStackBatchifier
public static final class PaddingStackBatchifier.Builder extends java.lang.ObjectBuilder to build aPaddingStackBatchifier.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PaddingStackBatchifier.BuilderaddPad(int array, int dim, NDArraySupplier supplier)Adds a new dimension to be padded in the inputNDList.PaddingStackBatchifier.BuilderaddPad(int array, int dim, NDArraySupplier supplier, int paddingSize)Adds a new dimension to be padded in the inputNDList.PaddingStackBatchifierbuild()Builds thePaddingStackBatchifier.PaddingStackBatchifier.BuilderoptIncludeValidLengths(boolean includeValidLengths)Sets whether to include the valid lengths (length of non-padded data) for each array.
-
-
-
Method Detail
-
optIncludeValidLengths
public PaddingStackBatchifier.Builder optIncludeValidLengths(boolean includeValidLengths)
Sets whether to include the valid lengths (length of non-padded data) for each array.- Parameters:
includeValidLengths- true to include valid lengths- Returns:
- this builder
-
addPad
public PaddingStackBatchifier.Builder addPad(int array, int dim, NDArraySupplier supplier)
Adds a new dimension to be padded in the inputNDList.- Parameters:
array- which array in theNDListto paddim- which dimension in the array to padsupplier- a supplier that produces the padding array. The padding array shape should include both the batch and a 1 for the padded dimension. For batch array shape NTC, the padding shape should be N x 1 x C- Returns:
- this builder
-
addPad
public PaddingStackBatchifier.Builder addPad(int array, int dim, NDArraySupplier supplier, int paddingSize)
Adds a new dimension to be padded in the inputNDList.- Parameters:
array- which array in theNDListto paddim- which dimension in the array to padsupplier- a supplier that produces the padding array. The padding array shape should include both the batch and a 1 for the padded dimension. For batch array shape NTC, the padding shape should be N x 1 x CpaddingSize- the minimum padding size to use. All sequences to pad must be less than this size- Returns:
- this builder
-
build
public PaddingStackBatchifier build()
Builds thePaddingStackBatchifier.- Returns:
- the constructed
PaddingStackBatchifier
-
-