Package ai.djl.translate
Class NoopTranslator
- java.lang.Object
-
- ai.djl.translate.NoopTranslator
-
- All Implemented Interfaces:
PostProcessor<NDList>,PreProcessor<NDList>,Translator<NDList,NDList>
public class NoopTranslator extends java.lang.Object implements Translator<NDList,NDList>
A no operationalTranslatorimplementation.
-
-
Constructor Summary
Constructors Constructor Description NoopTranslator()Constructs aNoopTranslator.NoopTranslator(Batchifier batchifier)Constructs aNoopTranslatorwith the givenBatchifier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchifiergetBatchifier()Returns theBatchifier.NDListprocessInput(TranslatorContext ctx, NDList input)Processes the input and converts it to NDList.NDListprocessOutput(TranslatorContext ctx, NDList list)Processes the output NDList to the corresponding output object.voidsetBatchifier(Batchifier batchifier)Sets theBatchifierfor the Translator.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ai.djl.translate.Translator
getExpansions, prepare, toBatchTranslator, toBatchTranslator
-
-
-
-
Constructor Detail
-
NoopTranslator
public NoopTranslator(Batchifier batchifier)
Constructs aNoopTranslatorwith the givenBatchifier.- Parameters:
batchifier- batchifier to use
-
NoopTranslator
public NoopTranslator()
Constructs aNoopTranslator.
-
-
Method Detail
-
processInput
public NDList processInput(TranslatorContext ctx, NDList input)
Processes the input and converts it to NDList.- Specified by:
processInputin interfacePreProcessor<NDList>- Parameters:
ctx- the toolkit for creating the input NDArrayinput- the input object- Returns:
- the
NDListafter pre-processing
-
processOutput
public NDList processOutput(TranslatorContext ctx, NDList list)
Processes the output NDList to the corresponding output object.- Specified by:
processOutputin interfacePostProcessor<NDList>- Parameters:
ctx- the toolkit used for post-processinglist- the output NDList after inference, usually immutable in engines like PyTorch. @see Issue 1774- Returns:
- the output object of expected type
-
getBatchifier
public Batchifier getBatchifier()
Returns theBatchifier.- Specified by:
getBatchifierin interfaceTranslator<NDList,NDList>- Returns:
- the
Batchifier
-
setBatchifier
public void setBatchifier(Batchifier batchifier)
Sets theBatchifierfor the Translator.- Parameters:
batchifier- theBatchifierfor the Translator
-
-