def __init__(self, parent, capacity, numdim_list, typesize=4, randomize=False,
              verbose=False, **kwargs):
    """Initialize a Cache.
    Args:
      parent: object that will provide data to this cache. Must have a Get().
      capacity: Maximum number of bytes that can fit in the cache.
      numdim_list: List of dimensions of the data.
      typesize: size (in bytes) of an atomic data entry.
      randomize: If True, shuffle the vectors after receiving them from the
        parent.
      verbose: If True, print info about what is happening.
    """
    self.parent = parent
    self.num_data = len(numdim_list)
    self.numdims = sum(numdim_list)
    self.numdim_list = numdim_list
    self._maxpos = capacity / (self.numdims * typesize)
    self.verbose = verbose
    self.capacity = self._maxpos * self.numdims * typesize
    self.typesize = typesize
    self._pos = 0
    self.data = []
    self.datasize = 0
    self.randomize = randomize
    if self.verbose:
      print 'Capacity %d bytes for data of size %d X %d rand=%s' % (
        self.capacity, self._maxpos, self.numdims, randomize)
Initialize a Cache.
    Args:
      parent: object that will provide data to this cache. Must have a Get().
      capacity: Maximum number of bytes that can fit in the cache.
      numdim_list: List of dimensions of the data.
      typesize: size (in bytes) of an atomic data entry.
      randomize: If True, shuffle the vectors after receiving them from the
        parent.
      verbose: If True, print info about what is happening.
    
deepnet/datahandler.py