class_docstr: Ring buffer of recent data batches for minibatch SGD.
  
  This is for use with AsyncSamplesOptimizer.
class_docstr_tok: ["Ring","buffer","of","recent","data","batches","for","minibatch","SGD",".","This","is","for","use","with","AsyncSamplesOptimizer","."]
docstr: Initialize a minibatch buffer.
  
  Args:
     inqueue (queue.Queue): Queue to populate the internal ring buffer
     from.
     size: Max number of data items to buffer.
     timeout: Queue timeout
     num_passes: Max num times each data item should be emitted.
     init_num_passes: Initial passes for each data item.
     Maxiumum number of passes per item are increased to num_passes over
     time.
docstr_tok: ["Initialize","a","minibatch","buffer",".","Args",":","inqueue","(","queue.Queue",")",":","Queue","to","populate","the","internal","ring","buffer","from",".","size",":","Max","number","of","data","items","to","buffer",".","timeout",":","Queue","timeout","num_passes",":","Max","num","times","each","data","item","should","be","emitted",".","init_num_passes",":","Initial","passes","for","each","data","item",".","Maxiumum","number","of","passes","per","item","are","increased","to","num_passes","over","time","."]
code: def __init__(
      self,
      inqueue: queue.Queue,
      size: int,
      timeout: float,
      num_passes: int,
      init_num_passes: int = 1,
  ):
      """Initialize a minibatch buffer.
  
      Args:
         inqueue (queue.Queue): Queue to populate the internal ring buffer
         from.
         size: Max number of data items to buffer.
         timeout: Queue timeout
         num_passes: Max num times each data item should be emitted.
         init_num_passes: Initial passes for each data item.
         Maxiumum number of passes per item are increased to num_passes over
         time.
      """
      self.inqueue = inqueue
      self.size = size
      self.timeout = timeout
      self.max_initial_ttl = num_passes
      self.cur_initial_ttl = init_num_passes
      self.buffers = [None] * size
      self.ttl = [0] * size
      self.idx = 0
  
imports: from typing import Any, Tuple
  import queue
label_desc: Use image node_id 1 to create a new MinibatchBuffer object  with example: obj = MinibatchBuffer(inqueue, size, timeout, num_passes, init_num_passes)