Interface TranslatorContext

  • All Superinterfaces:
    java.lang.AutoCloseable

    public interface TranslatorContext
    extends java.lang.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 Detail

      • getModel

        Model getModel()
        Returns the Model object to understand the input/output.
        Returns:
        the Model
      • 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

        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 value
        value - value assosicated with key
      • close

        void close()
        Specified by:
        close in interface java.lang.AutoCloseable