ó
    [C˜jƒ  ã                   óp   • S SK r S SKr\ R                  " S5        S rS rS rSS jrS rS rSS	 jr	S
 r
g)é    Nz´The 'torchvision.transforms._functional_video' module is deprecated since 0.12 and will be removed in the future. Please use the 'torchvision.transforms.functional' module instead.c                 óÈ   • [         R                  " U 5      (       d  [        S[        U 5      -  5      eU R	                  5       S:X  d  [        SU R                  5       -  5      eg)Nzclip should be Tensor. Got %sé   zclip should be 4D. Got %dDT)ÚtorchÚ	is_tensorÚ	TypeErrorÚtypeÚ
ndimensionÚ
ValueErrorÚdim©Úclips    Ú¶C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\torchvision/transforms/_functional_video.pyÚ_is_tensor_video_clipr      sO   € Ü�?Š?˜4× Ñ ÜÐ7¼$¸t»*ÑDÓEÐEà�?‰?Ó Ó!ÜÐ5¸¿¹»
ÑBÓCÐCàó    c                 ór   • [        U R                  5       5      S:w  a  [        S5      eU SXU-   2X"U-   24   $ )zO
Args:
    clip (torch.tensor): Video clip to be cropped. Size is (C, T, H, W)
r   zclip should be a 4D tensor.)ÚlenÚsizer
   )r   ÚiÚjÚhÚws        r   Úcropr      sA   € ô
 ˆ4�9‰9‹;Ó˜1ÓÜÐ5Ó6Ð6Ø��Q˜Q™�Y ¨¡E 	Ð)Ñ*Ð*r   c                 óŽ   • [        U5      S:w  a  [        SU 35      e[        R                  R                  R                  XUSS9$ )Né   z9target size should be tuple (height, width), instead got F)r   ÚmodeÚalign_corners)r   r
   r   ÚnnÚ
functionalÚinterpolate)r   Útarget_sizeÚinterpolation_modes      r   Úresizer"       sH   € Ü
ˆ;Ó˜1ÓÜÐTÐU`ÐTaÐbÓcÐcÜ�8‰8×Ñ×*Ñ*¨4ÐHZÐjoÐ*ÐpÐpr   c                 ón   • [        U 5      (       d  [        S5      e[        XX#U5      n [        XU5      n U $ )aé  
Do spatial cropping and resizing to the video clip
Args:
    clip (torch.tensor): Video clip to be cropped. Size is (C, T, H, W)
    i (int): i in (i,j) i.e coordinates of the upper left corner.
    j (int): j in (i,j) i.e coordinates of the upper left corner.
    h (int): Height of the cropped region.
    w (int): Width of the cropped region.
    size (tuple(int, int)): height and width of resized clip
Returns:
    clip (torch.tensor): Resized and cropped clip. Size is (C, T, H, W)
ú clip should be a 4D torch.tensor)r   r
   r   r"   )r   r   r   r   r   r   r!   s          r   Úresized_cropr%   &   s;   € ô ! ×&Ñ&ÜÐ;Ó<Ð<Ü�˜˜qÓ!€DÜ�$Ð0Ó1€DØ€Kr   c                 ó*  • [        U 5      (       d  [        S5      eU R                  S5      U R                  S5      p2Uu  pEX$:  d  X5:  a  [        S5      e[        [	        X$-
  S-  5      5      n[        [	        X5-
  S-  5      5      n[        XXtU5      $ )Nr$   éþÿÿÿéÿÿÿÿz2height and width must be no smaller than crop_sizeg       @)r   r
   r   ÚintÚroundr   )r   Ú	crop_sizer   r   ÚthÚtwr   r   s           r   Úcenter_cropr.   :   s…   € Ü  ×&Ñ&ÜÐ;Ó<Ð<Ø�9‰9�R‹=˜$Ÿ)™) B›-€qØ�F€BØƒv�“ÜÐMÓNÐNäŒE�1‘6˜S‘.Ó!Ó"€AÜŒE�1‘6˜S‘.Ó!Ó"€AÜ�˜ Ó#Ð#r   c                 óà   • [        U 5        U R                  [        R                  :X  d!  [	        S[        U R                  5      -  5      eU R                  5       R                  SSSS5      S-  $ )zÿ
Convert tensor data type from uint8 to float, divide value by 255.0 and
permute the dimensions of clip tensor
Args:
    clip (torch.tensor, dtype=torch.uint8): Size is (T, H, W, C)
Return:
    clip (torch.tensor, dtype=torch.float): Size is (C, T, H, W)
z/clip tensor should have data type uint8. Got %sé   r   é   r   g     ào@)r   Údtyper   Úuint8r   ÚstrÚfloatÚpermuter   s    r   Ú	to_tensorr7   G   sZ   € ô ˜$ÔØ�:‰:œŸ™Ó$ÜÐIÌCÐPT×PZÑPZËOÑ[Ó\Ð\Ø�:‰:‹<×Ñ  1 a¨Ó+¨eÑ3Ð3r   c                 ór  • [        U 5      (       d  [        S5      eU(       d  U R                  5       n [        R                  " XR
                  U R                  S9n[        R                  " X R
                  U R                  S9nU R                  USS2SSS4   5      R                  USS2SSS4   5        U $ )zù
Args:
    clip (torch.tensor): Video clip to be normalized. Size is (C, T, H, W)
    mean (tuple): pixel RGB mean. Size is (3)
    std (tuple): pixel standard deviation. Size is (3)
Returns:
    normalized clip (torch.tensor): Size is (C, T, H, W)
r$   )r2   ÚdeviceN)	r   r
   Úcloner   Ú	as_tensorr2   r9   Úsub_Údiv_)r   ÚmeanÚstdÚinplaces       r   Ú	normalizerA   V   s‘   € ô ! ×&Ñ&ÜÐ;Ó<Ð<ÞØ�z‰z‹|ˆÜ�?Š?˜4§z¡z¸$¿+¹+ÑF€DÜ
�/Š/˜#§Z¡Z¸¿¹Ñ
D€CØ‡I�Iˆd’1�d˜D $Ð&Ñ'Ó(×-Ñ-¨c²!°T¸4ÀÐ2EÑ.FÔGØ€Kr   c                 óZ   • [        U 5      (       d  [        S5      eU R                  S5      $ )z‘
Args:
    clip (torch.tensor): Video clip to be normalized. Size is (C, T, H, W)
Returns:
    flipped clip (torch.tensor): Size is (C, T, H, W)
r$   r(   )r   r
   Úflipr   s    r   ÚhfliprD   i   s)   € ô ! ×&Ñ&ÜÐ;Ó<Ð<Ø�9‰9�R‹=Ðr   )Úbilinear)F)Úwarningsr   Úwarnr   r   r"   r%   r.   r7   rA   rD   © r   r   Ú<module>rI      sH   ðÛ ã ð 	‡‚ðIôòò+òqôò(
$ò4ôó&	r   