class_docstr: Dataset of synthetically generated demonstrations.
code: def __getitem__(self, idx):
      i = idx // self.limit_rank
      j = idx % self.limit_rank
      output_tensor = torch.load(
          os.path.join(self.save_dir, f"output_tensor_{i}.pt")
      )
      list_of_triplets = torch.load(
          os.path.join(self.save_dir, f"list_of_triplets_{i}.pt")
      )
      if j != self.limit_rank - 1:
          moves = list_of_triplets[j + 1 :]  # noqa E203
          output_tensor = self._apply_moves(output_tensor, moves)
      triplet = list_of_triplets[j]
      output_tensor = torch.stack(
          [
              output_tensor,
              *(
                  compute_move(t)
                  for t in reversed(
                      list_of_triplets[
                          j
                          + 1 : j
                          + 1
                          + self.n_prev_actions  # noqa E203
                      ]
                  )
              ),
          ]
      )
      if len(output_tensor) < self.n_prev_actions + 1:
          output_tensor = torch.cat(
              [
                  output_tensor,
                  torch.zeros(
                      self.n_prev_actions + 1 - len(output_tensor),
                      *output_tensor.shape[1:],
                  ),
              ]
          )
      policy = map_triplet_to_action(
          triplet, base=5, n_steps=self.n_steps
      )
      reward = torch.tensor([-(j + 1)])
      scalar = get_scalars(
          output_tensor, self.limit_rank - j, with_bs=False
      )
      return (
          output_tensor.to(self.device),
          scalar.to(self.device),
          policy.to(self.device),
          reward.to(self.device),
      )
  
imports: import json
  import os
  import shutil
  import tempfile
  from pathlib import Path
  from typing import List, Tuple
  import numpy
  import torch
  from torch.utils.data import Dataset
  from open_alpha_tensor.core.data.generation import generate_synthetic_data
  from open_alpha_tensor.core.data.utils import get_scalars, map_triplet_to_action
label_desc: Use image node_id 3 for calling the SyntheticDataBuffer obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: output_tensor,  scalar,  policy,  reward