class_docstr: ## Dataset
  
  This is the PyTorch dataset that loads the dataset created
  by `build_dataset`.
docstr: Get a sample
docstr_tok: ["Get","a","sample"]
code: def __getitem__(self, idx: int):
      """
      Get a sample
      """
      # Get the sample
      s = self.samples[idx]
      # Tokenize
      src = self.tds.text_to_i(s[0])
      tgt = self.tds.text_to_i(s[1])
      neighbors = torch.stack(
          [
              torch.stack([self.tds.text_to_i(n) for n in chunks])
              for chunks in s[2]
          ]
      )
      #
      return src, tgt, neighbors
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/transformers/retro/dataset.py
imports: import json
  from pathlib import Path
  import numpy
  import torch
  from torch.utils.data import Dataset
  from labml import lab, monit
  from labml_helpers.datasets.text import TextFileDataset, TextDataset
  from labml_nn.transformers.retro.database import RetroIndex
label_desc: Use image node_id 3 for calling the Dataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: src,  tgt,  neighbors