class_docstr: Dataloader for loading batch data
  
  Example:
      .. code-block:: python
          from pgl.utils.data import Dataset
          from pgl.utils.data.dataloader import Dataloader
  
          class MyDataset(Dataset):
              def __init__(self):
                  self.data = list(range(0, 40))
  
              def __getitem__(self, idx):
                  return self.data[idx]
  
              def __len__(self):
                  return len(self.data)
  
          def collate_fn(batch_examples):
              feed_dict = {}
              feed_dict['data'] = batch_examples
              return feed_dict
  
          dataset = MyDataset()
          loader = Dataloader(dataset, 
                              batch_size=3,
                              drop_last=False,
                              shuffle=True,
                              num_workers=4,
                              collate_fn=collate_fn)
  
          for batch_data in loader:
              print(batch_data)
class_docstr_tok: ["Dataloader","for","loading","batch","data","Example",":","..","code-block",":",":","python","from","pgl.utils.data","import","Dataset","from","pgl.utils.data.dataloader","import","Dataloader","class","MyDataset","(","Dataset",")",":","def","__init__","(","self",")",":","self.data","=","list","(","range","(","0",",","40",")",")","def","__getitem__","(","self",",","idx",")",":","return","self.data","[","idx","]","def","__len__","(","self",")",":","return","len","(","self.data",")","def","collate_fn","(","batch_examples",")",":","feed_dict","=","{","}","feed_dict","[","'data","'","]","=","batch_examples","return","feed_dict","dataset","=","MyDataset","(",")","loader","=","Dataloader","(","dataset",",","batch_size=3",",","drop_last=False",",","shuffle=True",",","num_workers=4",",","collate_fn=collate_fn",")","for","batch_data","in","loader",":","print","(","batch_data",")"]
code: def __len__(self):
      if not isinstance(self.dataset, StreamDataset):
          return len(self.sampler)
      else:
          raise "StreamDataset has no length"
  
imports: import warnings
  import time
  import numpy
  from collections import namedtuple
  import paddle
  import paddle.fluid
  import paddle.fluid.layers
  from pgl.utils import mp_reader
  from pgl.utils.data.dataset import Dataset, StreamDataset
  from pgl.utils.data.sampler import Sampler, StreamSampler
label_desc: Use image node_id 2 for calling the Dataloader obj's underlying member method code with example usage: obj.__len__() and returns: len