§
    [zniÙ  ã                   ó–  — d dl Z d dlZd dlmZ d„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
dd
„Z ej        ej        j        ¦  «         ej        d¦  «        k    rd„ Zej        j        j        ZeZneZeZee
eeeee	ej        j        j        ej        j        j        ej        j        j        ej        j        j        ej        j        j        dœZd„ ZdS )é    N)Úversionc           
      óØ   — t          j        | ¦  «        } ddt           j                             | t          j        t          j        d¦  «        | j        ¦  «        z  ¦  «        z   z  }| |z  S )av  
    Gaussian Error Linear Unit. Original Implementation of the gelu activation function in Google Bert repo when
    initially created. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
    0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) Also see
    https://arxiv.org/abs/1606.08415
    ç      à?ç      ð?ç       @)ÚtfÚconvert_to_tensorÚmathÚerfÚcastÚsqrtÚdtype)ÚxÚcdfs     ú{/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/transformers/activations_tf.pyÚ_gelur      sU   € õ 	Ô˜QÑÔ€AØ
�•r”w—{’{ 1¥r¤w­r¬w°s©|¬|¸Q¼WÑ'EÔ'EÑ#EÑFÔFÑFÑ
G€Càˆs‰7€Nó    c                 óF  — t          j        | ¦  «        } t          j        t          j        | j        ¦  «        }t          j        d| j        ¦  «        }ddt          j        t          j        d|z  ¦  «        | |t          j        | d¦  «        z  z   z  ¦  «        z   z  }| |z  S )zò
    Gaussian Error Linear Unit. This is a smoother version of the GELU. Original paper: https://arxiv.org/abs/1606.0841

    Args:
        x: float Tensor to perform activation

    Returns:
        `x` with the GELU activation applied.
    ç÷Hmâä¦?r   r   r   é   )	r   r	   r   r
   Úpir   Útanhr   Úpow)r   r   Úcoeffr   s       r   Ú	_gelu_newr   "   s…   € õ 	Ô˜QÑÔ€AÝ	Œ•”˜!œ'Ñ	"Ô	"€BÝŒG�H˜aœgÑ&Ô&€EØ
�•r”w�rœw s¨R¡xÑ0Ô0°A¸ÅÄÀqÈ!ÁÄÑ8LÑ4LÑMÑNÔNÑNÑ
O€Càˆs‰7€Nr   c                 ó’   — t          j        | ¦  «        } | t          j        t           j                             | ¦  «        ¦  «        z  S )N)r   r	   r   r
   Úsoftplus©r   s    r   Úmishr   4   s7   € Ý
Ô˜QÑÔ€Aà�rŒw•r”w×'Ò'¨Ñ*Ô*Ñ+Ô+Ñ+Ð+r   c                 óê   — t          j        | ¦  «        } t          j        d| j        ¦  «        }t          j        d| j        ¦  «        }d| z  dt          j        | |z  d|| z  | z  z   z  ¦  «        z   z  S )Nr   g€ÑÓ3Eˆé?r   r   )r   r	   r   r   r   )r   Úcoeff1Úcoeff2s      r   Ú	gelu_fastr#   :   sl   € Ý
Ô˜QÑÔ€AÝŒW�X˜qœwÑ'Ô'€FÝŒW�\ 1¤7Ñ+Ô+€Fà�‰7�c�BœG A¨¡J°#¸À¹
ÀQ¹Ñ2FÑ$GÑHÔHÑHÑIÐIr   c                 ó¨   — t          j        | ¦  «        } t          j        d| j        ¦  «        }| t           j                             || z  ¦  «        z  S )Ng¬Zd;û?)r   r	   r   r   r
   Úsigmoid)r   r   s     r   Ú
quick_gelur&   B   sB   € Ý
Ô˜QÑÔ€AÝŒG�E˜1œ7Ñ#Ô#€EØ�rŒw�Š˜u q™yÑ)Ô)Ñ)Ð)r   c                 óH   — t          j        t          | ¦  «        dd¦  «        S )a˜  
    Clip the range of possible GeLU outputs between [-10, 10]. This is especially useful for quantization purpose, as
    it allows mapping 2 negatives values in the GeLU spectrum. For more information on this trick, please refer to
    https://arxiv.org/abs/2004.09602

    Gaussian Error Linear Unit. Original Implementation of the gelu activation function in Google Bert repo when
    initially created. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
    0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) Also see
    https://arxiv.org/abs/1606.08415 :param x: :return:
    iöÿÿÿé
   )r   Úclip_by_valuer   r   s    r   Úgelu_10r*   H   s   € õ Ô�E !™HœH c¨2Ñ.Ô.Ð.r   éÿÿÿÿc                 óz   — t          j        | d|¬¦  «        \  }}|t           j                             |¦  «        z  S )aÈ  
    Gated Linear Unit. Implementation as defined in the original paper (see https://arxiv.org/abs/1612.08083), where
    the input `x` is split in two halves across a dimension (`axis`), A and B, returning A * sigmoid(B).

    Args:
        `x`: float Tensor to perform activation
        `axis`: dimension across which `x` be split in half

    Returns:
        `x` with the GLU activation applied (with its size halved across the dimension `axis`).
    é   )Úaxis)r   Úsplitr
   r%   )r   r.   ÚaÚbs       r   Úglur2   V   s7   € õ Œ8�A�q˜tÐ$Ñ$Ô$�D€A€qØ�rŒw�Š˜qÑ!Ô!Ñ!Ð!r   z2.4c                 óN   — t           j        j                             | d¬¦  «        S )NT)Úapproximate)r   ÚkerasÚactivationsÚgelur   s    r   Úapproximate_gelu_wrapr8   h   s    € ÝŒxÔ#×(Ò(¨¸Ð(Ñ=Ô=Ð=r   )r7   r*   r#   Úgelu_newr2   r   r&   Úrelur%   ÚsiluÚswishr   c           	      ó    — | t           v rt           |          S t          d| › dt          t                                ¦   «         ¦  «        › �¦  «        ‚)Nz	function z not found in ACT2FN mapping )ÚACT2FNÚKeyErrorÚlistÚkeys)Úactivation_strings    r   Úget_tf_activationrC   ‚   sO   € Ø�FÐ"Ð"ÝÐ'Ô(Ð(åÐhÐ#4ÐhÐhÕSWÕX^×XcÒXcÑXeÔXeÑSfÔSfÐhÐhÑiÔiÐir   )r+   )r
   Ú
tensorflowr   Ú	packagingr   r   r   r   r#   r&   r*   r2   ÚparseÚVERSIONr8   r5   r6   r7   r9   r:   r%   r<   r   r>   rC   © r   r   ú<module>rI      sp  ðð €€€à Ð Ð Ð Ø Ð Ð Ð Ð Ð ð
ð 
ð 
ðð ð ð$,ð ,ð ,ðJð Jð Jð*ð *ð *ð/ð /ð /ð"ð "ð "ð "ð  €7„=�”Ô#Ñ$Ô$¨¨¬°eÑ(<Ô(<Ò<Ð<ð>ð >ð >ð Œ8ÔÔ$€DØ$€H€Hà€DØ€Hð ØØØØØØØŒHÔ Ô%ØŒxÔ#Ô+ØŒHÔ Ô&ØŒXÔ!Ô'ØŒHÔ Ô%ð
ð 
€ð jð jð jð jð jr   