class_docstr: Reservoir sample with a fixed sized buffer.
class_docstr_tok: ["Reservoir","sample","with","a","fixed","sized","buffer","."]
code: def add(self, x, idx=None):
      if self.counter < self.size:
          self.data[self.counter] = x
          self.idxs[self.counter] = idx or self.counter
      elif (
          self.counter >= self.size
          and numpy.random.random()
          < self.size / float(self.counter + 1)
      ):
          i = numpy.random.randint(self.size)
          self.data[i] = x
          self.idxs[i] = idx or self.counter
      self.counter += 1
  
imports: from __future__ import division
  import os
  import warnings
  import numpy
  import six
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer.training import extension
  from chainer.training import trigger
  from chainer.utils import argument
label_desc: Use image node_id 2 for calling the Reservoir obj's underlying member method code with example usage: obj.add(x, idx) without return types