def METHOD_NAME(self, num_mini_batch: int):
    triples = [
        (i0, a, i1)
        for a, v in self.action_to_saved_transitions.items()
        for (i0, i1) in v
    ]
    random.shuffle(triples)
    if len(triples) == 0:
        return
    parts = partition_sequence(
        triples, math.ceil(len(triples) / self.target_batch_size)
    )
    for part in parts:
        img0s, actions, img1s = unzip(part, n=3)
        img0 = torch.stack([i0.to(self.device) for i0 in img0s], 0)
        action = torch.tensor(actions, device=self.device)
        img1 = torch.stack([i1.to(self.device) for i1 in img1s], 0)
        self._total_samples_returned_in_batches += img0.shape[0]
        yield {"img0": img0, "action": action, "img1": img1}