§
    Ÿ²Åj£
  ã                   óÀ   — U d dl mZ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e         fd„ZdS )é    )ÚCallableÚOptionalé   )ÚFakeImplHolder)ÚRegistrationHandle)ÚSimpleLibraryRegistryÚSimpleOperatorEntryÚ	singletonc                   ó(   — e Zd ZdZd„ Zdeddfd„ZdS )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.
    c                 ó   — i | _         d S ©N©Ú_data©Úselfs    úOC:\Projects\Historical\venv\Lib\site-packages\torch/_library/simple_registry.pyÚ__init__zSimpleLibraryRegistry.__init__   s   € ØˆŒ
ˆ
ˆ
ó    ÚqualnameÚreturnr	   c                 ó\   — || j         vrt          |¦  «        | j         |<   | j         |         S r   )r   r	   ©r   r   s     r   ÚfindzSimpleLibraryRegistry.find   s0   € Ø˜4œ:Ð%Ð%Ý#6°xÑ#@Ô#@ˆDŒJ�xÑ ØŒz˜(Ô#Ð#r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústrr   © r   r   r   r      sP   € € € € € ðð ðð ð ð$˜Sð $Ð%:ð $ð $ð $ð $ð $ð $r   r   r
   c                   ó4   — e Zd ZdZdefd„Zed„ ¦   «         ZdS )r	   z„This is 1:1 to an operator overload.

    The fields of SimpleOperatorEntry are Holders where kernels can be
    registered to.
    r   c                 ód   — || _         t          |¦  «        | _        t          |¦  «        | _        d S r   )r   r   Ú	fake_implÚGenericTorchDispatchRuleHolderÚtorch_dispatch_rulesr   s     r   r   zSimpleOperatorEntry.__init__.   s1   € Ø%ˆŒÝ)7¸Ñ)AÔ)AˆŒå*¨8Ñ4Ô4ð 	Ô!Ð!Ð!r   c                 ó   — | j         S r   )r"   r   s    r   Úabstract_implz!SimpleOperatorEntry.abstract_impl6   s
   € àŒ~Ðr   N)r   r   r   r   r   r   Úpropertyr&   r   r   r   r	   r	   '   sT   € € € € € ðð ð
 ð 
ð 
ð 
ð 
ð ðð ñ „Xðð ð r   r	   c                   ó.   — e Zd Zd„ Zdededefd„Zd„ ZdS )r#   c                 ó"   — i | _         || _        d S r   )r   r   r   s     r   r   z'GenericTorchDispatchRuleHolder.__init__<   s   € ØˆŒ
Ø ˆŒˆˆr   Útorch_dispatch_classÚfuncr   c                 ó    ‡ ‡— ‰                       ‰¦  «        rt          ‰› d‰ j        › �¦  «        ‚|‰ j        ‰<   ˆ ˆfd„}t	          |¦  «        S )Nz8 already has a `__torch_dispatch__` rule registered for c                  ó   •— ‰ j         ‰= d S r   r   ©r   r*   s   €€r   Ú
deregisterz;GenericTorchDispatchRuleHolder.register.<locals>.deregisterI   s   ø€ Ø”
Ð/Ð0Ð0Ð0r   )r   ÚRuntimeErrorr   r   r   )r   r*   r+   r/   s   ``  r   Úregisterz'GenericTorchDispatchRuleHolder.register@   s   øø€ ð �9Š9Ð)Ñ*Ô*ð 	ÝØ'ÐpÐpÐaeÔanÐpÐpñô ð ð ,0ˆŒ
Ð'Ñ(ð	1ð 	1ð 	1ð 	1ð 	1ð 	1õ " *Ñ-Ô-Ð-r   c                 ó8   — | j                              |d ¦  «        S r   )r   Úgetr.   s     r   r   z#GenericTorchDispatchRuleHolder.findN   s   € ØŒz�~Š~Ð2°DÑ9Ô9Ð9r   N)	r   r   r   r   Útyper   r   r1   r   r   r   r   r#   r#   ;   s^   € € € € € ð!ð !ð !ð.Ø$(ð.Ø08ð.à	ð.ð .ð .ð .ð:ð :ð :ð :ð :r   r#   r*   r   c                 óp   — t                                | j        ¦  «        j                             |¦  «        S r   )r
   r   r   r$   )Úopr*   s     r   Úfind_torch_dispatch_ruler7   R   s.   € Ý�>Š>˜"œ/Ñ*Ô*Ô?×DÒDØñô ð r   N)Útypingr   r   r"   r   Úutilsr   Ú__all__r   r
   Ú__annotations__r	   r#   r4   r7   r   r   r   ú<module>r<      s  ðà %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à %Ð %Ð %Ð %Ð %Ð %Ø %Ð %Ð %Ð %Ð %Ð %ð HÐ
GÐ
G€ð$ð $ð $ð $ð $ñ $ô $ð $ð2 $9Ð#8Ñ#:Ô#:€	Ð Ð :Ð :Ñ :ðð ð ð ð ñ ô ð ð(:ð :ð :ð :ð :ñ :ô :ð :ð.°tð ÀÈÔ@Rð ð ð ð ð ð r   