Interface TranslatorContext

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
Predictor.PredictorContext

public interface TranslatorContext extends AutoCloseable
The TranslatorContext 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 Details

    • getModel

      Model getModel()
      Returns the Model object to understand the input/output.
      Returns:
      the Model
    • getNDManager

      NDManager getNDManager()
      Returns the NDManager to create NDArray.
      Returns:
      the NDManager
    • getPredictorManager

      NDManager getPredictorManager()
      Returns the Predictor's NDManager.
      Returns:
      the Predictor's NDManager
    • getBlock

      Block getBlock()
      Returns the block from the TranslatorContext.
      Returns:
      the block from the TranslatorContext
    • getMetrics

      Metrics getMetrics()
      Returns the Metric tool to do benchmark.
      Returns:
      the Metrics
    • getAttachment

      Object getAttachment(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(String key, Object value)
      Set a key-value pair of attachments.
      Parameters:
      key - key of attached value
      value - value assosicated with key
    • close

      void close()
      Specified by:
      close in interface AutoCloseable