class_docstr: Action forecasting video data set for EpicKitchen-55 Dataset.
  <https://epic-kitchens.github.io/2019/>
  
  This dataset handles the loading, decoding, and clip sampling for the videos.
class_docstr_tok: ["Action","forecasting","video","data","set","for","EpicKitchen-55","Dataset",".","<","https",":","\/\/epic-kitchens.github.io\/2019\/",">","This","dataset","handles","the","loading",",","decoding",",","and","clip","sampling","for","the","videos","."]
docstr: Args:
      transform (Callable[[Dict[str, Any]], Dict[str, Any]]): A function that performs
      any operation on a clip before it is returned in the default transform function.
      num_forecast_actions: (int) The number of actions to be included in the
          action vector.
      frames_per_clip (int): The number of frames per clip to sample.
      num_input_clips (int): The number of subclips to be included in the video data.
  
  Returns:
      A function that performs any operation on a clip and returns the transformed clip.
docstr_tok: ["Args",":","transform","(","Callable","[","[","Dict","[","str",",","Any","]","]",",","Dict","[","str",",","Any","]","]",")",":","A","function","that","performs","any","operation","on","a","clip","before","it","is","returned","in","the","default","transform","function",".","num_forecast_actions",":","(","int",")","The","number","of","actions","to","be","included","in","the","action","vector",".","frames_per_clip","(","int",")",":","The","number","of","frames","per","clip","to","sample",".","num_input_clips","(","int",")",":","The","number","of","subclips","to","be","included","in","the","video","data",".","Returns",":","A","function","that","performs","any","operation","on","a","clip","and","returns","the","transformed","clip","."]
code: def _transform_generator(
      transform: Callable[[Dict[str, Any]], Dict[str, Any]],
      num_forecast_actions: int,
      frames_per_clip: int,
      num_input_clips: int,
  ) -> Callable[[Dict[str, Any]], Dict[str, Any]]:
      """
      Args:
          transform (Callable[[Dict[str, Any]], Dict[str, Any]]): A function that performs
          any operation on a clip before it is returned in the default transform function.
          num_forecast_actions: (int) The number of actions to be included in the
              action vector.
          frames_per_clip (int): The number of frames per clip to sample.
          num_input_clips (int): The number of subclips to be included in the video data.
  
      Returns:
          A function that performs any operation on a clip and returns the transformed clip.
      """
  
      def transform_clip(clip: Dict[str, Any]) -> Dict[str, Any]:
          assert all(
              clip["actions"][i].start_time
              <= clip["actions"][i + 1].start_time
              for i in range(len(clip["actions"]) - 1)
          ), "Actions must be sorted"
          next_k_actions: List[ActionData] = [
              a
              for a in clip["actions"]
              if (a.start_time > clip["stop_time"])
          ][:num_forecast_actions]
          clip["actions"] = next_k_actions
  
          assert (
              clip["video"].size()[1]
              == num_input_clips * frames_per_clip
          )
          clip_video_tensor = torch.stack(
              [
                  clip["video"][
                      :,
                      (i * frames_per_clip) : (
                          (i + 1) * frames_per_clip
                      ),
                      :,
                      :,
                  ]
                  for i in range(num_input_clips)
              ]
          )
          clip["video"] = clip_video_tensor
  
          for key in clip:
              if clip[key] is None:
                  clip[key] = torch.tensor([])
  
          if transform:
              clip = transform(clip)
  
          return clip
  
      return transform_clip
  
file_path: pytorchvideo/pytorchvideo/data/epic_kitchen_forecasting.py
imports: from dataclasses import fields
  from enum import Enum
  from typing import Any, Callable, Dict, List, Optional
  import torch
  from pytorchvideo.data.dataset_manifest_utils import EncodedVideoInfo, VideoClipInfo, VideoDatasetType, VideoFrameInfo, VideoInfo
  from pytorchvideo.data.epic_kitchen import ActionData, EpicKitchenDataset
  from pytorchvideo.data.video import Video
label_desc: Use image node_id 2 for calling the EpicKitchenForecasting obj's underlying member method code with example usage: obj._transform_generator(transform, num_forecast_actions, frames_per_clip, num_input_clips) and returns: transform_clip, clip