Ë
    [^(h¬  ã                   óÒ   — d dl mZ d dlmZ d dlZdeej
                     dej
                  fd„Zdej
                  deej
                     ddfd„Zd	ej
                  d
ee   defd„Z	y)é    )ÚIterable)ÚOptionalNÚ
parametersÚreturnc                 óš   — d}g }| D ].  }t        ||«      }|j                  |j                  d«      «       Œ0 t        j                  |«      S )zùFlatten an iterable of parameters into a single vector.

    Args:
        parameters (Iterable[Tensor]): an iterable of Tensors that are the
            parameters of a model.

    Returns:
        The parameters represented by a single vector
    Néÿÿÿÿ)Ú_check_param_deviceÚappendÚviewÚtorchÚcat)r   Úparam_deviceÚvecÚparams       ú_/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/nn/utils/convert_parameters.pyÚparameters_to_vectorr      sM   € ð €Là
€CØò #ˆä*¨5°,Ó?ˆà�
‰
�5—:‘:˜b“>Õ"ð	#ô
 �9‰9�S‹>Ðó    r   c                 ó  — t        | t        j                  «      s!t        dt        j                  | «      › �«      ‚d}d}|D ]I  }t        ||«      }|j                  «       }| |||z    j                  |«      j                  |_        ||z  }ŒK y)a  Copy slices of a vector into an iterable of parameters.

    Args:
        vec (Tensor): a single vector representing the parameters of a model.
        parameters (Iterable[Tensor]): an iterable of Tensors that are the
            parameters of a model.
    z expected torch.Tensor, but got: Nr   )	Ú
isinstancer   ÚTensorÚ	TypeErrorÚtypenamer	   ÚnumelÚview_asÚdata)r   r   r   Úpointerr   Ú	num_params         r   Úvector_to_parametersr      s“   € ô �cœ5Ÿ<™<Ô(ÜÐ:¼5¿>¹>È#Ó;NÐ:OÐPÓQÐQà€Lð €GØò 
ˆä*¨5°,Ó?ˆð —K‘K“Mˆ	à˜ 7¨YÑ#6Ð7×?Ñ?ÀÓF×KÑKˆŒ
ð 	�9Ñ‰ñ
r   r   Úold_param_devicec                 ó&  — dt         j                  j                  «       g}|€.| j                  j                  |v r| j                  «       }|S d}|S d}| j                  j                  |v r| j                  «       |k7  }n|dk7  }|rt        d«      ‚|S )a"  Check if the parameters are located on the same device.

    Currently, the conversion between model parameters and single vector form is not supported
    for multiple allocations, e.g. parameters in different GPUs/PrivateUse1s, or mixture of CPU/GPU/PrivateUse1.

    Args:
        param ([Tensor]): a Tensor of a parameter of a model
        old_param_device (int): the device where the first parameter of a
                                model is allocated.

    Returns:
        old_param_device (int): report device for the first time
    Úcudar   FzKFound two parameters on different devices, this is currently not supported.)r   Ú_CÚ_get_privateuse1_backend_nameÚdeviceÚtypeÚ
get_devicer   )r   r   Úsupport_device_typesÚwarns       r   r	   r	   :   s¶   € ð #¤E§H¡H×$JÑ$JÓ$LÐMÐØÐà"'§,¡,×"3Ñ"3Ð7KÑ"KˆE×ÑÓð 	ð  Ðð RTð 	ð  Ðð ˆà�L‰L×ÑÐ!5Ñ5à×#Ñ#Ó%Ð)9Ñ9‰Dà# rÑ)ˆDÙÜð3óð ð Ðr   )
Úcollections.abcr   Útypingr   r   r   r   r   Úintr	   © r   r   ú<module>r-      sy   ðÝ $Ý ã ð X¨e¯l©lÑ%;ð ÀÇÁó ð,˜eŸl™lð ¸ÀÇÁÑ8Nð ÐSWó ð:!˜uŸ|™|ð !¸xÈ¹}ð !ÐQTô !r   