class_docstr: Subsample/Upsample the number of frames in a sequence.
docstr: Args:
      img (numpy.ndarray): sequence to be sampled.
  Returns:
      numpy.ndarray: sampled sequence.
docstr_tok: ["Args",":","img","(","numpy.ndarray",")",":","sequence","to","be","sampled",".","Returns",":","numpy.ndarray",":","sampled","sequence","."]
code: def __call__(self, x):
      """
      Args:
          img (numpy.ndarray): sequence to be sampled.
      Returns:
          numpy.ndarray: sampled sequence.
      """
      if self._speed_rate <= 0:
          raise ValueError("speed_rate should be greater than zero.")
      if self._speed_rate == 1.0:
          return x
      old_length = x.shape[0]
      new_length = int(old_length / self._speed_rate)
      old_indices = np.arange(old_length)
      new_indices = np.linspace(
          start=0, stop=old_length, num=new_length, endpoint=False
      )
      new_indices = list(map(int, new_indices))
      x = x[new_indices]
      return x
  
imports: import random
  import cv2
  import numpy
  import torch
  from scipy import signal
label_desc: Use image node_id 2 for calling the SpeedRate obj's underlying member method code with example usage: obj.__call__(x) and returns: x, x