Package ai.djl.translate
Class NoopTranslator
java.lang.Object
ai.djl.translate.NoopTranslator
- All Implemented Interfaces:
PostProcessor<NDList>,PreProcessor<NDList>,Translator<NDList,NDList>
A no operational
Translator implementation.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aNoopTranslator.NoopTranslator(Batchifier batchifier) Constructs aNoopTranslatorwith the givenBatchifier. -
Method Summary
Modifier and TypeMethodDescriptionReturns theBatchifier.processInput(TranslatorContext ctx, NDList input) Processes the input and converts it to NDList.processOutput(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, waitMethods inherited from interface ai.djl.translate.Translator
batchProcessInput, batchProcessOutput, getExpansions, prepare
-
Constructor Details
-
NoopTranslator
Constructs aNoopTranslatorwith the givenBatchifier.- Parameters:
batchifier- batchifier to use
-
NoopTranslator
public NoopTranslator()Constructs aNoopTranslator.
-
-
Method Details
-
processInput
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
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
Returns theBatchifier.- Specified by:
getBatchifierin interfaceTranslator<NDList,NDList> - Returns:
- the
Batchifier
-
setBatchifier
Sets theBatchifierfor the Translator.- Parameters:
batchifier- theBatchifierfor the Translator
-