def Get(self, batchsize):
    """Reads data from disk.
    Args:
      batchsize: Number of data points to read.
    Returns:
      A list of numpy arrays each with batchsize rows. Each element of the list
      is one data modality.
    """
    data_list = []
    for i in range(self.num_data):
      key = self.keys[i]
      numdims = self.numdim_list[i]
      filename_list = self.filenames[i]
      num_files = self._num_file_list[i]
      current_file = (self.last_read_file[i] + 1) % num_files
      sparse = os.path.splitext(filename_list[current_file])[1] == '.npz'

      # Allocate memory for storing data that will come from the disk.
      if sparse:
        # Sparse matrices do not allow slice assignment, so we will stack them
        # as they come.
        data = None
      else:
        if self.data[i] is None:
          self.data[i] = np.zeros((batchsize, numdims), dtype='float32')
        data = self.data[i]
      datasize = 0  # Number of rows of data filled up.

      # First put any left overs from previous disk accesses.
      if self.left_overs[i] is not None:
        left_over_size = self.left_overs[i].shape[0]
        if left_over_size > batchsize:
          if sparse:
            data = self.left_overs[i][:batchsize]
          else:
            data[:batchsize] = self.left_overs[i][:batchsize]
          self.left_overs[i] = self.left_overs[i][batchsize:]
          datasize = batchsize
        else:
          if sparse:
            data = self.left_overs[i]
          else:
            data[:left_over_size] = self.left_overs[i]
          self.left_overs[i] = None
          datasize = left_over_size

      # Read data from disk.
      while(datasize < batchsize):
        if self.last_read_file[i] != current_file:
          this_chunk = self.ReadDiskData(filename_list[current_file], key)
          self.last_read_chunk[i] = this_chunk
          self.last_read_file[i] = current_file
        else:
          this_chunk = self.last_read_chunk[i]
        this_chunk_size = this_chunk.shape[0]

        if datasize + this_chunk_size > batchsize:
          # Put part of this_chunk into the data and remaining in left_overs.
          self.left_overs[i] = this_chunk[batchsize - datasize:]
          if sparse:
            data = self.AddSparseData(data, this_chunk[:batchsize - datasize])
          else:
            data[datasize : batchsize] = this_chunk[:batchsize - datasize]
          datasize = batchsize
        else:
          # Put whole of this_chunk into the data.
          self.left_overs[i] = None
          if sparse:
            data = self.AddSparseData(data, this_chunk)
          else:
            data[datasize : datasize + this_chunk_size] = this_chunk
          datasize += this_chunk_size
        current_file = (current_file + 1) % num_files
      data_list.append(data)
    return data_list
Reads data from disk.
    Args:
      batchsize: Number of data points to read.
    Returns:
      A list of numpy arrays each with batchsize rows. Each element of the list
      is one data modality.
    
deepnet/datahandler.py