class_docstr: Wrap a dataset so that, whenever a new item is returned, it is saved to memory.
class_docstr_tok: ["Wrap","a","dataset","so","that",",","whenever","a","new","item","is","returned",",","it","is","saved","to","memory","."]
code: def __getitem__(self, n):
      if self._cache[n] is not None:
          return self._cache[n]
  
      item = self.dataset[n]
      self._cache[n] = item
  
      return item
  
imports: from typing import Callable, List, Tuple
  import torch
  from torch import Tensor
  from torch.utils.data.dataset import random_split
  from torchaudio.datasets import LJSPEECH
label_desc: Use image node_id 2 for calling the MapMemoryCache obj's underlying member method code with example usage: obj.__getitem__(n) and returns: item, self