Class BatchProcessingGeneratorR>

java.lang.Object
com.itextpdf.pdfocr.onnxtr.util.BatchProcessingGeneratorR>
Type Parameters:
T - input type
R - output type
All Implemented Interfaces:
Iterator

public class BatchProcessingGeneratorR> extends Object implements Iterator
Generator with batch processing. It goes over and processes input values in batches and results are cached. This is useful for use in ML-models, where you want to process stuff in batches instead of one-by-ine.
  • Constructor Details

    • BatchProcessingGenerator

      public BatchProcessingGenerator (Iterator<List<T>> batchIterator, IBatchProcessor<T,R> batchProcessor)
      Creates a new generator with the provided batch iterator and processor.
      Parameters:
      batchIterator - input batch iterator
      batchProcessor - batch processor
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public R next()
      Specified by:
      next in interface Iterator<T>