Ë
    L²ju  ã                   óÂ   — U d dl mZ d dlmZ ddlmZ ddlmZ ddlm	Z	 g d¢Z
 G d„ d	«      Z e«       Zeed
<    G d„ d«      Z G d„ d«      Zdedededef   dz  fd„Zy)é    )ÚCallable)ÚAnyé   )ÚEffectHolder)ÚFakeImplHolder)ÚRegistrationHandle)ÚSimpleLibraryRegistryÚSimpleOperatorEntryÚ	singletonc                   ó(   — e Zd ZdZdd„Zdeddfd„Zy)	r	   aJ  Registry for the "simple" torch.library APIs

    The "simple" torch.library APIs are a higher-level API on top of the
    raw PyTorch DispatchKey registration APIs that includes:
    - fake impl

    Registrations for these APIs do not go into the PyTorch dispatcher's
    table because they may not directly involve a DispatchKey. For example,
    the fake impl is a Python function that gets invoked by FakeTensor.
    Instead, we manage them here.

    SimpleLibraryRegistry is a mapping from a fully qualified operator name
    (including the overload) to SimpleOperatorEntry.
    ÚreturnNc                 ó   — i | _         y ©N©Ú_data©Úselfs    ú]/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/torch/_library/simple_registry.pyÚ__init__zSimpleLibraryRegistry.__init__   s	   € Ø57ˆ�
ó    Úqualnamer
   c                 óv   — | j                   j                  |d «      }|€t        |«      x| j                   |<   }|S r   )r   Úgetr
   )r   r   Úress      r   ÚfindzSimpleLibraryRegistry.find   s8   € Ø�j‰j�n‰n˜X tÓ,ˆØˆ;Ü)<¸XÓ)FÐFˆD�J‰J�xÑ  3Øˆ
r   ©r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústrr   © r   r   r	   r	      s    „ ñó8ð˜Sð Ð%:ô r   r	   r   c                   ó6   — e Zd ZdZdeddfd„Zedefd„«       Zy)r
   z„This is 1:1 to an operator overload.

    The fields of SimpleOperatorEntry are Holders where kernels can be
    registered to.
    r   r   Nc                 ór   — || _         t        |«      | _        t        |«      | _        t        |«      | _        y r   )r   r   Ú	fake_implÚGenericTorchDispatchRuleHolderÚtorch_dispatch_rulesr   Úeffect©r   r   s     r   r   zSimpleOperatorEntry.__init__0   s3   € Ø%ˆŒÜ)7¸Ó)AˆŒä*¨8Ó4ð 	Ô!ô %1°Ó$:ˆ�r   c                 ó   — | j                   S r   )r%   r   s    r   Úabstract_implz!SimpleOperatorEntry.abstract_impl:   s   € à�~‰~Ðr   )	r   r   r   r    r!   r   Úpropertyr   r+   r"   r   r   r
   r
   )   s5   „ ñð; ð ;¨ó ;ð ð˜~ò ó ñr   r
   c                   óZ   — e Zd Zdeddfd„Zdededef   defd„Z	dededef   dz  fd	„Z
y)
r&   r   r   Nc                 ó    — i | _         || _        y r   )r   r   r)   s     r   r   z'GenericTorchDispatchRuleHolder.__init__@   s   € Ø57ˆŒ
Ø%ˆ�r   Útorch_dispatch_classÚfunc.c                 óž   ‡ ‡— ‰ j                  ‰«      rt        ‰› d‰ j                  › �«      ‚|‰ j                  ‰<   dˆ ˆfd„}t	        |«      S )Nz8 already has a `__torch_dispatch__` rule registered for c                  ó    •— ‰ j                   ‰= y r   r   ©r   r/   s   €€r   Ú
deregisterz;GenericTorchDispatchRuleHolder.register.<locals>.deregisterM   s   ø€ Ø—
‘
Ð/Ñ0r   r   )r   ÚRuntimeErrorr   r   r   )r   r/   r0   r4   s   ``  r   Úregisterz'GenericTorchDispatchRuleHolder.registerD   sZ   ù€ ð �9‰9Ð)Ô*ÜØ'Ð(Ð(`Ðae×anÑanÐ`oÐpóð ð ,0ˆ�
‰
Ð'Ñ(ö	1ô " *Ó-Ð-r   c                 ó:   — | j                   j                  |d «      S r   )r   r   r3   s     r   r   z#GenericTorchDispatchRuleHolder.findR   s   € Ø�z‰z�~‰~Ð2°DÓ9Ð9r   )r   r   r   r!   r   Útyper   r   r   r6   r   r"   r   r   r&   r&   ?   s\   „ ð& ð &¨ó &ð.Ø$(ð.Ø08¸¸c¸Ñ0Bð.à	ó.ð:¨ð :°(¸3À¸8Ñ2DÀtÑ2Kô :r   r&   Úopr/   r   .Nc                 ór   — t         j                  | j                  «      j                  j                  |«      S r   )r   r   r   r'   )r9   r/   s     r   Úfind_torch_dispatch_ruler;   V   s-   € ô �>‰>˜"Ÿ/™/Ó*×?Ñ?×DÑDØóð r   )Úcollections.abcr   Útypingr   Úeffectsr   r%   r   Úutilsr   Ú__all__r	   r   Ú__annotations__r
   r&   r8   r;   r"   r   r   ú<module>rB      su   ðÞ $Ý å !Ý %Ý %ò H€÷ñ ñ4 $9Ó#:€	Ð Ó :÷ñ ÷,:ñ :ð.ØðØ#'ðàˆc�3ˆhÑ˜$Ñôr   