class_docstr: Action recognition video dataset for
  `Something-something v2 (SSv2) <https://20bn.com/datasets/something-something>`_ stored
  as image frames.
  
  This dataset handles the parsing of frames, loading and clip sampling for the
  videos. All io is done through :code:`iopath.common.file_io.PathManager`, enabling
  non-local storage uri's to be used.
class_docstr_tok: ["Action","recognition","video","dataset","for","`","Something-something","v2","(","SSv2",")","<","https",":","\/\/20bn.com\/datasets\/something-something",">","`","_","stored","as","image","frames",".","This","dataset","handles","the","parsing","of","frames",",","loading","and","clip","sampling","for","the","videos",".","All","io","is","done","through",":","code",":","`","iopath.common.file_io.PathManager","`",",","enabling","non-local","storage","uri","'s","to","be","used","."]
docstr: Use segment-based input frame sampling that splits eachvideo into segments,
  and from each of them, we sample one frame to form a clip.
  
  Args:
      frame_indices (list): list of frame indices.
      frames_per_clip (int): The number of frames per clip to sample.
      rand_sample (bool): if True, randomly sampling frames.
  
  Returns:
      (list): Outputs a subsampled list with num_samples frames.
docstr_tok: ["Use","segment-based","input","frame","sampling","that","splits","eachvideo","into","segments",",","and","from","each","of","them",",","we","sample","one","frame","to","form","a","clip",".","Args",":","frame_indices","(","list",")",":","list","of","frame","indices",".","frames_per_clip","(","int",")",":","The","number","of","frames","per","clip","to","sample",".","rand_sample","(","bool",")",":","if","True",",","randomly","sampling","frames",".","Returns",":","(","list",")",":","Outputs","a","subsampled","list","with","num_samples","frames","."]
code: def _sample_clip_frames(
      frame_indices: List[int], frames_per_clip: int, rand_sample: bool
  ) -> List[int]:
      """
      Use segment-based input frame sampling that splits eachvideo into segments,
      and from each of them, we sample one frame to form a clip.
  
      Args:
          frame_indices (list): list of frame indices.
          frames_per_clip (int): The number of frames per clip to sample.
          rand_sample (bool): if True, randomly sampling frames.
  
      Returns:
          (list): Outputs a subsampled list with num_samples frames.
      """
      num_frames = len(frame_indices)
  
      seg_size = float(num_frames - 1) / frames_per_clip
      seq = []
      for i in range(frames_per_clip):
          start = int(np.round(seg_size * i))
          end = int(np.round(seg_size * (i + 1)))
          if rand_sample:
              seq.append(random.randint(start, end))
          else:
              seq.append((start + end) // 2)
  
      return [frame_indices[idx] for idx in seq]
  
imports: import csv
  import functools
  import json
  import os
  import random
  from collections import defaultdict
  from typing import Any, Callable, List, Optional, Tuple, Type
  import numpy
  import torch
  import torch.utils.data
  from iopath.common.file_io import g_pathmgr
  from pytorchvideo.data.clip_sampling import ClipSampler
  from pytorchvideo.data.frame_video import FrameVideo
  from .utils import MultiProcessSampler
label_desc: Use image node_id 2 for calling the SSv2 obj's underlying member method code with example usage: obj._sample_clip_frames(frame_indices, frames_per_clip, rand_sample) and returns: unknown