class_docstr: A `DataLoader` is responsible for generating batches of instances from a
  [`DatasetReader`](/api/data/dataset_readers/dataset_reader/#datasetreader),
  or another source of data.
  
  This is purely an abstract base class. All concrete subclasses must provide
  implementations of the following methods:
  
    - [`__iter__()`](#__iter__) that creates an iterable of `TensorDict`s,
    - [`iter_instances()`](#iter_instances) that creates an iterable of `Instance`s,
    - [`index_with()`](#index_with) that should index the data with a vocabulary, and
    - [`set_target_device()`](#set_target_device), which updates the device that batch
      tensors should be put it when they are generated in `__iter__()`.
  
  Additionally, this class should also implement `__len__()` when possible.
  
  The default implementation is
  [`MultiProcessDataLoader`](../multiprocess_data_loader/#multiprocessdataloader).
class_docstr_tok: ["A","`","DataLoader","`","is","responsible","for","generating","batches","of","instances","from","a","[","`","DatasetReader","`","]","(","\/api\/data\/dataset_readers\/dataset_reader\/","#","datasetreader",")",",","or","another","source","of","data",".","This","is","purely","an","abstract","base","class",".","All","concrete","subclasses","must","provide","implementations","of","the","following","methods",":","-","[","`","__iter__","(",")","`","]","(","#","__iter__",")","that","creates","an","iterable","of","`","TensorDict","`","s",",","-","[","`","iter_instances","(",")","`","]","(","#","iter_instances",")","that","creates","an","iterable","of","`","Instance","`","s",",","-","[","`","index_with","(",")","`","]","(","#","index_with",")","that","should","index","the","data","with","a","vocabulary",",","and","-","[","`","set_target_device","(",")","`","]","(","#","set_target_device",")",",","which","updates","the","device","that","batch","tensors","should","be","put","it","when","they","are","generated","in","`","__iter__","(",")","`",".","Additionally",",","this","class","should","also","implement","`","__len__","(",")","`","when","possible",".","The","default","implementation","is","[","`","MultiProcessDataLoader","`","]","(","..","\/multiprocess_data_loader\/","#","multiprocessdataloader",")","."]
code: def __len__(self) -> int:
      raise TypeError
  
file_path: allennlp/allennlp/data/data_loaders/data_loader.py
imports: from typing import Dict, Union, Iterator
  import torch
  from allennlp.common.registrable import Registrable
  from allennlp.data.instance import Instance
  from allennlp.data.vocabulary import Vocabulary
label_desc: Use image node_id 1 for calling the DataLoader obj's underlying member method code with example usage: obj.__len__() without return types