prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  What is expected Kinetics400 dataset directory structure?
  Given that the dataset does not come with official downloader scripts and that most roll their own or hack some third-party scripts, it would be much clearer if https://pytorch.org/docs/stable/torchvision/datasets.html#kinetics-400 explained what directory structure is expected by `torchvision.datasets.Kinetics400`
  
  What is the expected dataset size? and the video file extensions?
  
  Thanks!
  
  cc @pmeier
  
  </issue>
  <code>
  [start of torchvision/datasets/kinetics.py]
  1 from .utils import list_dir
  2 from .folder import make_dataset
  3 from .video_utils import VideoClips
  4 from .vision import VisionDataset
  5 
  6 
  7 class Kinetics400(VisionDataset):
  8     """
  9     `Kinetics-400 <https://deepmind.com/research/open-source/open-source-datasets/kinetics/>`_
  10     dataset.
  11 
  12     Kinetics-400 is an action recognition video dataset.
  13     This dataset consider every video as a collection of video clips of fixed size, specified
  14     by ``frames_per_clip``, where the step in frames between each clip is given by
  15     ``step_between_clips``.
  16 
  17     To give an example, for 2 videos with 10 and 15 frames respectively, if ``frames_per_clip=5``
  18     and ``step_between_clips=5``, the dataset size will be (2 + 3) = 5, where the first two
  19     elements will come from video 1, and the next three elements from video 2.
  20     Note that we drop clips which do not have exactly ``frames_per_clip`` elements, so not all
  21     frames in a video might be present.
  22 
  23     Internally, it uses a VideoClips object to handle clip creation.
  24 
  25     Args:
  26         root (string): Root directory of the Kinetics-400 Dataset.
  27         frames_per_clip (int): number of frames in a clip
  28         step_between_clips (int): number of frames between each clip
  29         transform (callable, optional): A function/transform that  takes in a TxHxWxC video
  30             and returns a transformed version.
  31 
  32     Returns:
  33         tuple: A 3-tuple with the following entries:
  34 
  35             - video (Tensor[T, H, W, C]): the `T` video frames
  36             - audio(Tensor[K, L]): the audio frames, where `K` is the number of channels
  37               and `L` is the number of points
  38             - label (int): class of the video clip
  39     """
  40 
  41     def __init__(self, root, frames_per_clip, step_between_clips=1, frame_rate=None,
  42                  extensions=('avi',), transform=None, _precomputed_metadata=None,
  43                  num_workers=1, _video_width=0, _video_height=0,
  44                  _video_min_dimension=0, _audio_samples=0, _audio_channels=0):
  45         super(Kinetics400, self).__init__(root)
  46 
  47         classes = list(sorted(list_dir(root)))
  48         class_to_idx = {classes[i]: i for i in range(len(classes))}
  49         self.samples = make_dataset(self.root, class_to_idx, extensions, is_valid_file=None)
  50         self.classes = classes
  51         video_list = [x[0] for x in self.samples]
  52         self.video_clips = VideoClips(
  53             video_list,
  54             frames_per_clip,
  55             step_between_clips,
  56             frame_rate,
  57             _precomputed_metadata,
  58             num_workers=num_workers,
  59             _video_width=_video_width,
  60             _video_height=_video_height,
  61             _video_min_dimension=_video_min_dimension,
  62             _audio_samples=_audio_samples,
  63             _audio_channels=_audio_channels,
  64         )
  65         self.transform = transform
  66 
  67     @property
  68     def metadata(self):
  69         return self.video_clips.metadata
  70 
  71     def __len__(self):
  72         return self.video_clips.num_clips()
  73 
  74     def __getitem__(self, idx):
  75         video, audio, info, video_idx = self.video_clips.get_clip(idx)
  76         label = self.samples[video_idx][1]
  77 
  78         if self.transform is not None:
  79             video = self.transform(video)
  80 
  81         return video, audio, label
  82
  [end of torchvision/datasets/kinetics.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/torchvision/datasets/kinetics.py b/torchvision/datasets/kinetics.py
  --- a/torchvision/datasets/kinetics.py
  +++ b/torchvision/datasets/kinetics.py
  @@ -23,7 +23,18 @@
       Internally, it uses a VideoClips object to handle clip creation.
   
       Args:
  -        root (string): Root directory of the Kinetics-400 Dataset.
  +        root (string): Root directory of the Kinetics-400 Dataset. Should be structured as follows:
  +            .. code::
  +
  +                root/
  +                ├── class1
  +                │   ├── clip1.avi
  +                │   ├── clip2.avi
  +                │   └── ...
  +                └── class2
  +                    ├── clipx.avi
  +                    └── ...
  +
           frames_per_clip (int): number of frames in a clip
           step_between_clips (int): number of frames between each clip
           transform (callable, optional): A function/transform that  takes in a TxHxWxC video
  
verification_info: {"golden_diff": "diff --git a/torchvision/datasets/kinetics.py b/torchvision/datasets/kinetics.py\n--- a/torchvision/datasets/kinetics.py\n+++ b/torchvision/datasets/kinetics.py\n@@ -23,7 +23,18 @@\n     Internally, it uses a VideoClips object to handle clip creation.\n \n     Args:\n-        root (string): Root directory of the Kinetics-400 Dataset.\n+        root (string): Root directory of the Kinetics-400 Dataset. Should be structured as follows:\n+            .. code::\n+\n+                root/\n+                \u251c\u2500\u2500 class1\n+                \u2502   \u251c\u2500\u2500 clip1.avi\n+                \u2502   \u251c\u2500\u2500 clip2.avi\n+                \u2502   \u2514\u2500\u2500 ...\n+                \u2514\u2500\u2500 class2\n+                    \u251c\u2500\u2500 clipx.avi\n+                    \u2514\u2500\u2500 ...\n+\n         frames_per_clip (int): number of frames in a clip\n         step_between_clips (int): number of frames between each clip\n         transform (callable, optional): A function/transform that  takes in a TxHxWxC video\n", "issue": "What is expected Kinetics400 dataset directory structure?\nGiven that the dataset does not come with official downloader scripts and that most roll their own or hack some third-party scripts, it would be much clearer if https://pytorch.org/docs/stable/torchvision/datasets.html#kinetics-400 explained what directory structure is expected by `torchvision.datasets.Kinetics400`\r\n\r\nWhat is the expected dataset size? and the video file extensions?\r\n\r\nThanks!\n\ncc @pmeier\n", "before_files": [{"content": "from .utils import list_dir\nfrom .folder import make_dataset\nfrom .video_utils import VideoClips\nfrom .vision import VisionDataset\n\n\nclass Kinetics400(VisionDataset):\n    \"\"\"\n    `Kinetics-400 <https://deepmind.com/research/open-source/open-source-datasets/kinetics/>`_\n    dataset.\n\n    Kinetics-400 is an action recognition video dataset.\n    This dataset consider every video as a collection of video clips of fixed size, specified\n    by ``frames_per_clip``, where the step in frames between each clip is given by\n    ``step_between_clips``.\n\n    To give an example, for 2 videos with 10 and 15 frames respectively, if ``frames_per_clip=5``\n    and ``step_between_clips=5``, the dataset size will be (2 + 3) = 5, where the first two\n    elements will come from video 1, and the next three elements from video 2.\n    Note that we drop clips which do not have exactly ``frames_per_clip`` elements, so not all\n    frames in a video might be present.\n\n    Internally, it uses a VideoClips object to handle clip creation.\n\n    Args:\n        root (string): Root directory of the Kinetics-400 Dataset.\n        frames_per_clip (int): number of frames in a clip\n        step_between_clips (int): number of frames between each clip\n        transform (callable, optional): A function/transform that  takes in a TxHxWxC video\n            and returns a transformed version.\n\n    Returns:\n        tuple: A 3-tuple with the following entries:\n\n            - video (Tensor[T, H, W, C]): the `T` video frames\n            - audio(Tensor[K, L]): the audio frames, where `K` is the number of channels\n              and `L` is the number of points\n            - label (int): class of the video clip\n    \"\"\"\n\n    def __init__(self, root, frames_per_clip, step_between_clips=1, frame_rate=None,\n                 extensions=('avi',), transform=None, _precomputed_metadata=None,\n                 num_workers=1, _video_width=0, _video_height=0,\n                 _video_min_dimension=0, _audio_samples=0, _audio_channels=0):\n        super(Kinetics400, self).__init__(root)\n\n        classes = list(sorted(list_dir(root)))\n        class_to_idx = {classes[i]: i for i in range(len(classes))}\n        self.samples = make_dataset(self.root, class_to_idx, extensions, is_valid_file=None)\n        self.classes = classes\n        video_list = [x[0] for x in self.samples]\n        self.video_clips = VideoClips(\n            video_list,\n            frames_per_clip,\n            step_between_clips,\n            frame_rate,\n            _precomputed_metadata,\n            num_workers=num_workers,\n            _video_width=_video_width,\n            _video_height=_video_height,\n            _video_min_dimension=_video_min_dimension,\n            _audio_samples=_audio_samples,\n            _audio_channels=_audio_channels,\n        )\n        self.transform = transform\n\n    @property\n    def metadata(self):\n        return self.video_clips.metadata\n\n    def __len__(self):\n        return self.video_clips.num_clips()\n\n    def __getitem__(self, idx):\n        video, audio, info, video_idx = self.video_clips.get_clip(idx)\n        label = self.samples[video_idx][1]\n\n        if self.transform is not None:\n            video = self.transform(video)\n\n        return video, audio, label\n", "path": "torchvision/datasets/kinetics.py"}]}