Package ai.djl.translate
Interface TranslatorContext
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface TranslatorContext extends java.lang.AutoCloseable
TheTranslatorContext
interface provides a toolkit for pre-processing and postprocessing functionality.You can use this in
Translator
to get Model information and create an NDArray
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
java.lang.Object
getAttachment(java.lang.String key)
Returns value of attached key-value pair to context.Block
getBlock()
Returns the block from theTranslatorContext
.Metrics
getMetrics()
Returns the Metric tool to do benchmark.Model
getModel()
Returns theModel
object to understand the input/output.NDManager
getNDManager()
NDManager
getPredictorManager()
Returns the Predictor'sNDManager
.void
setAttachment(java.lang.String key, java.lang.Object value)
Set a key-value pair of attachments.
-
-
-
Method Detail
-
getModel
Model getModel()
Returns theModel
object to understand the input/output.- Returns:
- the
Model
-
getPredictorManager
NDManager getPredictorManager()
Returns the Predictor'sNDManager
.- Returns:
- the Predictor's
NDManager
-
getBlock
Block getBlock()
Returns the block from theTranslatorContext
.- Returns:
- the block from the
TranslatorContext
-
getAttachment
java.lang.Object getAttachment(java.lang.String key)
Returns value of attached key-value pair to context.- Parameters:
key
- key of attached value- Returns:
- the object stored in relevant map
-
setAttachment
void setAttachment(java.lang.String key, java.lang.Object value)
Set a key-value pair of attachments.- Parameters:
key
- key of attached valuevalue
- value assosicated with key
-
close
void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-