class_docstr: Evenly splits the video into clips of size clip_duration.
class_docstr_tok: ["Evenly","splits","the","video","into","clips","of","size","clip_duration","."]
docstr: Helper to calculate the start/end clip with backpad logic
docstr_tok: ["Helper","to","calculate","the","start\/end","clip","with","backpad","logic"]
code: def _clip_start_end(
      self,
      last_clip_end_time: Union[float, Fraction],
      video_duration: Union[float, Fraction],
      backpad_last: bool,
  ) -> Tuple[Fraction, Fraction]:
      """
      Helper to calculate the start/end clip with backpad logic
      """
      delta = self._stride - self._clip_duration
      last_end_time = (
          -delta if last_clip_end_time is None else last_clip_end_time
      )
      clip_start = Fraction(last_end_time + delta)
      clip_end = Fraction(clip_start + self._clip_duration)
      if backpad_last:
          buffer_amount = max(0, clip_end - video_duration)
          clip_start -= buffer_amount
          clip_start = Fraction(max(0, clip_start))  # handle rounding
          clip_end = Fraction(clip_start + self._clip_duration)
  
      return clip_start, clip_end
  
imports: import random
  from abc import ABC, abstractmethod
  from fractions import Fraction
  from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union
label_desc: Use image node_id 2 for calling the UniformClipSampler obj's underlying member method code with example usage: obj._clip_start_end(last_clip_end_time, video_duration, backpad_last) and returns: clip_start,  clip_end