U
    +Ç-eü  ã                   @   s¨   d Z ddlZddlmZmZ g Zejjjejjj	ejjj
ejjjejjjejjjejjjejjjejjjejjjejjjejjjejjjejjjgZdd„ Zdd„ ZdS )	zô
These are functions that should simply be applied to both mask and data.
Take select or stack as an example. This operation can be applied to
both the mask and data of a MaskedTensor and the result wrapped into
a new MaskedTensor as a result.
é    Né   ©Ú_map_mt_args_kwargsÚ_wrap_resultc                 C   s   | t kS ©N)ÚPASSTHROUGH_FNS)Úfn© r	   úf/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/torch/masked/maskedtensor/passthrough.pyÚ_is_pass_through_fn"   s    r   c           	      O   sF   t ||dd„ ƒ\}}| ||Ž}t ||dd„ ƒ\}}| ||Ž}t||ƒS )Nc                 S   s   |   ¡ S r   )Úget_data©Úxr	   r	   r
   Ú<lambda>'   ó    z(_apply_pass_through_fn.<locals>.<lambda>c                 S   s   |   ¡ S r   )Zget_maskr   r	   r	   r
   r   )   r   r   )	r   ÚargsÚkwargsZ	data_argsZdata_kwargsZresult_dataZ	mask_argsZmask_kwargsZresult_maskr	   r	   r
   Ú_apply_pass_through_fn&   s
    

r   )Ú__doc__ZtorchÚcorer   r   Ú__all__ZopsZatenÚselectZ	transposeÚsplitÚtÚsliceZslice_backwardZselect_backwardÚindexÚexpandÚviewZ_unsafe_viewZ_reshape_aliasÚcatZ	unsqueezer   r   r   r	   r	   r	   r
   Ú<module>   s(   ò