Class BigGANTranslator

java.lang.Object
ai.djl.modality.cv.translator.BigGANTranslator
All Implemented Interfaces:
NoBatchifyTranslator<int[],Image[]>, PostProcessor<Image[]>, PreProcessor<int[]>, Translator<int[],Image[]>

public final class BigGANTranslator extends Object implements NoBatchifyTranslator<int[],Image[]>
Built-in Translator that provides preprocessing and postprocessing for BigGAN.
  • Constructor Details

    • BigGANTranslator

      public BigGANTranslator(float truncation)
      Constructs a translator for BigGAN.
      Parameters:
      truncation - value used to scale the normal seed for BigGAN
  • Method Details

    • processOutput

      public Image[] processOutput(TranslatorContext ctx, NDList list)
      Processes the output NDList to the corresponding output object.
      Specified by:
      processOutput in interface PostProcessor<Image[]>
      Parameters:
      ctx - the toolkit used for post-processing
      list - the output NDList after inference, usually immutable in engines like PyTorch. @see Issue 1774
      Returns:
      the output object of expected type
    • processInput

      public NDList processInput(TranslatorContext ctx, int[] input) throws Exception
      Processes the input and converts it to NDList.
      Specified by:
      processInput in interface PreProcessor<int[]>
      Parameters:
      ctx - the toolkit for creating the input NDArray
      input - the input object
      Returns:
      the NDList after pre-processing
      Throws:
      Exception - if an error occurs during processing input