class_docstr: Base AudioVideo Reader
  
  Args:
      opts: command line arguments
      is_training: Training or validation mode. Default: `False`.
class_docstr_tok: ["Base","AudioVideo","Reader","Args",":","opts",":","command","line","arguments","is_training",":","Training","or","validation","mode",".","Default",":","`","False","`","."]
docstr: Given entire audio tensor of a video file and the indices of the sampled
  audio frames, pad to the desire shape if needed and return the audio clips.
  
  Args:
      full_audio_tensor: A [T x C] tensor of all frames of a audio, where T is the
          total number of frames, C is the number of channels. The audio is mono
          when C == 1 and stero when C == 2.
      aclip_ids: A [clips_per_video x N] tensor of the index of the sampled frames
          in `full_audio_tensor`, where N is the number of sampled frames.
      clip_duration: The duration in second of each clip.
      clips_per_video: Number of clips per video to generate.
      audio_fps: The frame rate of the audio. The audio is not changed in this
          function.
      num_samples_per_clip: Number of samples to generate for each clip. This is
          to match the shape of the video if multiple samples are generated during
          training.
  
  Returns:
      A [clips_per_video x N x C] tensor as the audio clips, where N is the number
      of frames within `clip_duration` time at `audio_fps` frame rate.
docstr_tok: ["Given","entire","audio","tensor","of","a","video","file","and","the","indices","of","the","sampled","audio","frames",",","pad","to","the","desire","shape","if","needed","and","return","the","audio","clips",".","Args",":","full_audio_tensor",":","A","[","T","x","C","]","tensor","of","all","frames","of","a","audio",",","where","T","is","the","total","number","of","frames",",","C","is","the","number","of","channels",".","The","audio","is","mono","when","C","==","1","and","stero","when","C","==","2.","aclip_ids",":","A","[","clips_per_video","x","N","]","tensor","of","the","index","of","the","sampled","frames","in","`","full_audio_tensor","`",",","where","N","is","the","number","of","sampled","frames",".","clip_duration",":","The","duration","in","second","of","each","clip",".","clips_per_video",":","Number","of","clips","per","video","to","generate",".","audio_fps",":","The","frame","rate","of","the","audio",".","The","audio","is","not","changed","in","this","function",".","num_samples_per_clip",":","Number","of","samples","to","generate","for","each","clip",".","This","is","to","match","the","shape","of","the","video","if","multiple","samples","are","generated","during","training",".","Returns",":","A","[","clips_per_video","x","N","x","C","]","tensor","as","the","audio","clips",",","where","N","is","the","number","of","frames","within","`","clip_duration","`","time","at","`","audio_fps","`","frame","rate","."]
code: def _generate_audio_clips(
      self,
      full_audio_tensor: torch.Tensor,
      aclip_ids: Optional[torch.Tensor],
      clip_duration: float,
      clips_per_video: int,
      audio_fps: float,
      num_samples_per_clip: Optional[int] = 1,
  ) -> torch.Tensor:
      """Given entire audio tensor of a video file and the indices of the sampled
      audio frames, pad to the desire shape if needed and return the audio clips.
  
      Args:
          full_audio_tensor: A [T x C] tensor of all frames of a audio, where T is the
              total number of frames, C is the number of channels. The audio is mono
              when C == 1 and stero when C == 2.
          aclip_ids: A [clips_per_video x N] tensor of the index of the sampled frames
              in `full_audio_tensor`, where N is the number of sampled frames.
          clip_duration: The duration in second of each clip.
          clips_per_video: Number of clips per video to generate.
          audio_fps: The frame rate of the audio. The audio is not changed in this
              function.
          num_samples_per_clip: Number of samples to generate for each clip. This is
              to match the shape of the video if multiple samples are generated during
              training.
  
      Returns:
          A [clips_per_video x N x C] tensor as the audio clips, where N is the number
          of frames within `clip_duration` time at `audio_fps` frame rate.
      """
      num_audio_frames = full_audio_tensor.shape[0]
      # Compute the output clip length in second with the output fps and number of
      # frames.
      expected_num_audio_frames = int(clip_duration * audio_fps)
      if full_audio_tensor.shape[0] < expected_num_audio_frames:
          num_audio_frames_to_pad = (
              expected_num_audio_frames - full_audio_tensor.shape[0]
          )
          full_audio_tensor = F.pad(
              full_audio_tensor, (0, 0, 0, num_audio_frames_to_pad)
          )
          audio_clips = full_audio_tensor.repeat(
              (clips_per_video, 1, 1)
          )
      else:
          # [num_frames, channels] --> [num_clips, per_clip_audio, channels]
          audio_clips = full_audio_tensor[aclip_ids]
          num_audio_frames_to_pad = (
              expected_num_audio_frames - audio_clips.shape[1]
          )
          audio_clips = F.pad(
              audio_clips, (0, 0, 0, num_audio_frames_to_pad)
          )
  
      # Duplicate audio if multiple samples are generated for each clip at training
      # time.
      audio_clips = torch.repeat_interleave(
          audio_clips, num_samples_per_clip, dim=0
      )
  
      return audio_clips
  
imports: import argparse
  import random
  from typing import Dict, Optional, Tuple
  import av
  import numpy
  import torch
  import torch.nn.functional
  from torch import Tensor
  from data.transforms import BaseTransformation
  from data.transforms import image_pil
  from data.transforms.common import Compose
  from options.utils import extend_selected_args_with_prefix, extract_opts_with_prefix_replacement
  from utils import logger
label_desc: Use image node_id 12 for calling the BaseAVReader obj's underlying member method code with example usage: obj._generate_audio_clips(full_audio_tensor, aclip_ids, clip_duration, clips_per_video, audio_fps, num_samples_per_clip) and returns: audio_clips