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 __init__(self, dataset):
      self.dataset = dataset
      self._cache = [None] * len(dataset)
  
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 1 to create a new MapMemoryCache object from inherited base classes: torch.utils.data with example: obj = MapMemoryCache(dataset)