class_docstr: This class helps dealing with the invalid images in the dataset by using
  two queue. One queue is used to enqueue seen and valid images from previous
  batches. The other queue is used to dequeue. The class is implemented such
  that the same batch will never have duplicate images. If we can't dequeue a
  valid image, we return None for that instance.
  
  Args:
      queue_size: size the the queue (ideally set it to batch_size). Both queues
                  will be of the same size
class_docstr_tok: ["This","class","helps","dealing","with","the","invalid","images","in","the","dataset","by","using","two","queue",".","One","queue","is","used","to","enqueue","seen","and","valid","images","from","previous","batches",".","The","other","queue","is","used","to","dequeue",".","The","class","is","implemented","such","that","the","same","batch","will","never","have","duplicate","images",".","If","we","ca","n't","dequeue","a","valid","image",",","we","return","None","for","that","instance",".","Args",":","queue_size",":","size","the","the","queue","(","ideally","set","it","to","batch_size",")",".","Both","queues","will","be","of","the","same","size"]
docstr: If we encounter a successful image and the queue is not full, we store it
  in the queue. One consideration we make further is: if the image is very
  large, we don't add it to the queue as otherwise the CPU memory will grow
  a lot.
docstr_tok: ["If","we","encounter","a","successful","image","and","the","queue","is","not","full",",","we","store","it","in","the","queue",".","One","consideration","we","make","further","is",":","if","the","image","is","very","large",",","we","do","n't","add","it","to","the","queue","as","otherwise","the","CPU","memory","will","grow","a","lot","."]
code: def on_sucess(self, sample):
      """
      If we encounter a successful image and the queue is not full, we store it
      in the queue. One consideration we make further is: if the image is very
      large, we don't add it to the queue as otherwise the CPU memory will grow
      a lot.
      """
      if self._is_large_image(sample):
          return
      self._enqueue_valid_image(sample)
      if (
          self.enqueue_images_queue.full()
          and not self.dequeue_images_queue.full()
      ):
          self._refill_dequeue_buffer()
  
imports: import contextlib
  import logging
  import queue
  from typing import Dict, List
  import numpy
  import torch
  from PIL import Image
  from torch.utils.data import Dataset
  from torch.utils.data.distributed import DistributedSampler
label_desc: Use image node_id 9 for calling the QueueDataset obj's underlying member method code with example usage: obj.on_sucess(sample) without return types