class_docstr: A class for sampling training batches with a controlled composition
  of sequences.
class_docstr_tok: ["A","class","for","sampling","training","batches","with","a","controlled","composition","of","sequences","."]
docstr: Returns a list of (segment, index) tuples, one per eligible frame, where
      segment is a list of frame indices in the contiguous segment the frame
      belongs to index is the frame's index within that segment.
  Segment references are repeated but the memory is shared.
docstr_tok: ["Returns","a","list","of","(","segment",",","index",")","tuples",",","one","per","eligible","frame",",","where","segment","is","a","list","of","frame","indices","in","the","contiguous","segment","the","frame","belongs","to","index","is","the","frame","'s","index","within","that","segment",".","Segment","references","are","repeated","but","the","memory","is","shared","."]
code: def _build_segment_index(
      self, seq: str, size: int
  ) -> List[Tuple[List[int], int]]:
      """
      Returns a list of (segment, index) tuples, one per eligible frame, where
          segment is a list of frame indices in the contiguous segment the frame
          belongs to index is the frame's index within that segment.
      Segment references are repeated but the memory is shared.
      """
      if (
          self.consecutive_frames_max_gap > 0
          or self.consecutive_frames_max_gap_seconds > 0.0
      ):
          segments = self._split_to_segments(
              self.dataset.sequence_frames_in_order(seq)
          )
          segments = _cull_short_segments(segments, size)
          if not segments:
              raise AssertionError("Empty segments after culling")
      else:
          segments = [list(self.dataset.sequence_indices_in_order(seq))]
  
      # build an index of segment for random selection of a pivot frame
      segment_index = [
          (segment, i)
          for segment in segments
          for i in range(len(segment))
      ]
  
      return segment_index
  
file_path: pytorch3d/pytorch3d/implicitron/dataset/scene_batch_sampler.py
imports: import warnings
  from collections import Counter
  from dataclasses import dataclass, field
  from typing import Dict, Iterable, Iterator, List, Sequence, Tuple
  import numpy
  from torch.utils.data.sampler import Sampler
  from .dataset_base import DatasetBase
label_desc: Use image node_id 5 for calling the SceneBatchSampler obj's underlying member method code with example usage: obj._build_segment_index(seq, size) and returns: segment_index