
    Phn                     `    d dl Z d dlmZ d dlZd dlZddlmZ  G d de      Z G d de      Zy)	    N)reduce   )Functionc                   ,    e Zd Zed        Zed        Zy)Typec                     t        j                  d       t        |      | _        |j                  sdn|j                         | _        |j                  |      S )Nzptorch.autograd._functions.Type is deprecated as of PyTorch 2.1, please use torch.tensor.to(dtype=dtype) instead.)warningswarntype
input_typeis_cuda
get_deviceinput_device)ctxi	dest_types      kC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/autograd/_functions/tensor.pyforwardzType.forward
   sE    4	
 a%&YY2ALLNvvi      c                    | j                   dk(  r|j                  | j                        d fS t        j                  j                  | j                         5  |j                  | j                        d fcd d d        S # 1 sw Y   y xY w)Nr	   )r   r   r   torchcudadevicer   grad_outputs     r   backwardzType.backward   se    r!##CNN3T99""3#3#34"''7= 544s   A==BN__name__
__module____qualname__staticmethodr   r    r   r   r   r   	   s(    ! ! > >r   r   c                   ,    e Zd Zed        Zed        Zy)Resizec                    || _         t        d |d      | _        |j                         | j                  k7  r}t        dj	                  dj                  t        t        |            | j                  dj                  t        t        |j                                     |j                                     |j                         | _	        |j                  r.|j                  |        |j                         j                  | S |j                         r. |j                  |      j                         j                  | }|S  |j                         j                  | S )Nc                     | |z  S Nr#   )xys     r   <lambda>z Resize.forward.<locals>.<lambda>"   s    Ar      zrequested resize to {} ({} elements in total), but the given tensor has a size of {} ({} elements). autograd's resize can only change the shape of a given tensor, while preserving the number of elements. r)   )sizesr   numelRuntimeErrorformatjoinmapstrsizeinput_sizesis_quantizedcopy_
contiguousviewis_contiguousnew)r   tensorr-   results       r   r   zResize.forward   s   	-ua8	<<>SYY&H &HHSe_-IIHHSfkkm45LLN	  !++-LL +6$$&++U33!9VZZ'224995AFM+6$$&++U33r   c                     |j                         | j                   k(  sJ |j                         j                  | j                        d fS r(   )r.   r8   r9   r5   r   s     r   r   zResize.backward;   s@      "cii///%%',,S__=tCCr   Nr   r#   r   r   r%   r%      s*    4 46 D Dr   r%   )	r
   	functoolsr   r   torch._utilsfunctionr   r   r%   r#   r   r   <module>rB      s.        >8 >* DX  Dr   