public class QaServingTranslator extends java.lang.Object implements Translator<Input,Output>
Constructor and Description |
---|
QaServingTranslator(Translator<QAInput,java.lang.String> translator)
Constructs a
QaServingTranslator instance. |
Modifier and Type | Method and Description |
---|---|
Batchifier |
getBatchifier()
Gets the
Batchifier . |
void |
prepare(TranslatorContext ctx)
Prepares the translator with the manager and model to use.
|
NDList |
processInput(TranslatorContext ctx,
Input input)
Processes the input and converts it to NDList.
|
Output |
processOutput(TranslatorContext ctx,
NDList list)
Processes the output NDList to the corresponding output object.
|
public QaServingTranslator(Translator<QAInput,java.lang.String> translator)
QaServingTranslator
instance.translator
- a Translator
processes question answering inputpublic Batchifier getBatchifier()
Batchifier
.getBatchifier
in interface Translator<Input,Output>
Batchifier
public void prepare(TranslatorContext ctx) throws java.lang.Exception
prepare
in interface Translator<Input,Output>
ctx
- the context for the Predictor
.java.lang.Exception
- if there is an error for preparing the translatorpublic NDList processInput(TranslatorContext ctx, Input input) throws java.lang.Exception
processInput
in interface PreProcessor<Input>
ctx
- the toolkit for creating the input NDArrayinput
- the input objectNDList
after pre-processingjava.lang.Exception
- if an error occurs during processing inputpublic Output processOutput(TranslatorContext ctx, NDList list) throws java.lang.Exception
processOutput
in interface PostProcessor<Output>
ctx
- the toolkit used for post-processinglist
- the output NDList after inferencejava.lang.Exception
- if an error occurs during processing output