o
    ¡¿¯i;  ã                   @   s,   d dl mZ d dlmZ G dd„ deƒZdS )é    )Ú
AbsEnhLoss)ÚAbsLossWrapperc                       s0   e Zd Zddef‡ fdd„Zi fdd„Z‡  ZS )Ú
DPCLSolverç      ð?Ú	criterionc                    s   t ƒ  ¡  || _|| _d S )N)ÚsuperÚ__init__r   Úweight)Úselfr   r	   ©Ú	__class__© úY/home/ubuntu/.local/lib/python3.10/site-packages/espnet2/enh/loss/wrappers/dpcl_solver.pyr      s   

zDPCLSolver.__init__c                 C   sD   d|v sJ ‚|   ||d ¡ ¡ }tƒ }| ¡ || j j< | ¡ |i fS )aë  A naive DPCL solver

        Args:
            ref (List[torch.Tensor]): [(batch, ...), ...] x n_spk
            inf (List[torch.Tensor]): [(batch, ...), ...]
            others (List): other data included in this solver
                e.g. "tf_embedding" learned embedding of all T-F bins (B, T * F, D)

        Returns:
            loss: (torch.Tensor): minimum loss with the best permutation
            stats: (dict), for collecting training status
            others: reserved
        Útf_embedding)r   ÚmeanÚdictÚdetachÚname)r
   ÚrefÚinfÚothersÚlossÚstatsr   r   r   Úforward   s
   zDPCLSolver.forward)r   )Ú__name__Ú
__module__Ú__qualname__r   r   r   Ú__classcell__r   r   r   r   r      s    r   N)Ú$espnet2.enh.loss.criterions.abs_lossr   Ú%espnet2.enh.loss.wrappers.abs_wrapperr   r   r   r   r   r   Ú<module>   s    