Interface TranslatorOptions


  • public interface TranslatorOptions
    A set of possible options for Translators with different input and output types.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.util.Set<ai.djl.util.Pair<java.lang.reflect.Type,​java.lang.reflect.Type>> getOptions()
      Returns the supported wrap types.
      default boolean isSupported​(java.lang.Class<?> input, java.lang.Class<?> output)
      Returns if the input/output is a supported wrap type.
      <I,​O>
      Translator<I,​O>
      option​(java.lang.Class<I> input, java.lang.Class<O> output)
      Returns the Translator option with the matching input and output type.
    • Method Detail

      • getOptions

        java.util.Set<ai.djl.util.Pair<java.lang.reflect.Type,​java.lang.reflect.Type>> getOptions()
        Returns the supported wrap types.
        Returns:
        the supported wrap types
        See Also:
        option(Class, Class)
      • isSupported

        default boolean isSupported​(java.lang.Class<?> input,
                                    java.lang.Class<?> output)
        Returns if the input/output is a supported wrap type.
        Parameters:
        input - the input class
        output - the output class
        Returns:
        true if the input/output type is supported
        See Also:
        option(Class, Class)
      • option

        <I,​O> Translator<I,​O> option​(java.lang.Class<I> input,
                                                 java.lang.Class<O> output)
                                          throws TranslateException
        Returns the Translator option with the matching input and output type.
        Type Parameters:
        I - the input data type
        O - the output data type
        Parameters:
        input - the input class
        output - the output class
        Returns:
        a new instance of the Translator class
        Throws:
        TranslateException - if failed to create Translator instance