class_docstr: A minimal replay buffer used by Decision Transformer (DT)
  to process episodes into max_seq_len length segments and do shuffling.
class_docstr_tok: ["A","minimal","replay","buffer","used","by","Decision","Transformer","(","DT",")","to","process","episodes","into","max_seq_len","length","segments","and","do","shuffling","."]
docstr: Add a SampleBatch of episodes. Replace if full.
  
  Args:
      batch: SampleBatch of full episodes.
docstr_tok: ["Add","a","SampleBatch","of","episodes",".","Replace","if","full",".","Args",":","batch",":","SampleBatch","of","full","episodes","."]
code: def add(self, batch: SampleBatch):
      """Add a SampleBatch of episodes. Replace if full.
  
      Args:
          batch: SampleBatch of full episodes.
      """
      episodes = batch.split_by_episode(key=SampleBatch.DONES)
      for episode in episodes:
          self._add_single_episode(episode)
  
file_path: ray/rllib_contrib/dt/src/rllib_dt/dt/segmentation_buffer.py
imports: import logging
  import random
  from collections import defaultdict
  from typing import List
  import numpy
  from ray.rllib.evaluation.postprocessing import discount_cumsum
  from ray.rllib.policy.sample_batch import MultiAgentBatch, SampleBatch, concat_samples
  from ray.rllib.utils.typing import SampleBatchType
label_desc: Use image node_id 2 for calling the SegmentationBuffer obj's underlying member method code with example usage: obj.add(batch) without return types