Package ai.djl.inference
Class Predictor.PredictorContext
java.lang.Object
ai.djl.inference.Predictor.PredictorContext
- All Implemented Interfaces:
TranslatorContext,AutoCloseable
An implementation of
TranslatorContext.-
Constructor Summary
ConstructorsConstructorDescriptionPredictorContext(Model model, NDManager predictorManager, Metrics metrics) Constructs a newPredictorContextinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getAttachment(String key) Returns value of attached key-value pair to context.getBlock()Returns the block from theTranslatorContext.Returns the Metric tool to do benchmark.getModel()Returns theModelobject to understand the input/output.Returns the Predictor'sNDManager.voidsetAttachment(String key, Object value) Set a key-value pair of attachments.
-
Constructor Details
-
PredictorContext
Constructs a newPredictorContextinstance.
-
-
Method Details
-
getModel
Returns theModelobject to understand the input/output.- Specified by:
getModelin interfaceTranslatorContext- Returns:
- the
Model
-
getNDManager
- Specified by:
getNDManagerin interfaceTranslatorContext- Returns:
- the
NDManager
-
getPredictorManager
Returns the Predictor'sNDManager.- Specified by:
getPredictorManagerin interfaceTranslatorContext- Returns:
- the Predictor's
NDManager
-
getBlock
Returns the block from theTranslatorContext.- Specified by:
getBlockin interfaceTranslatorContext- Returns:
- the block from the
TranslatorContext
-
getMetrics
Returns the Metric tool to do benchmark.- Specified by:
getMetricsin interfaceTranslatorContext- Returns:
- the
Metrics
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTranslatorContext
-
getAttachment
Returns value of attached key-value pair to context.- Specified by:
getAttachmentin interfaceTranslatorContext- Parameters:
key- key of attached value- Returns:
- the object stored in relevant map
-
setAttachment
Set a key-value pair of attachments.- Specified by:
setAttachmentin interfaceTranslatorContext- Parameters:
key- key of attached valuevalue- value assosicated with key
-