
    [ThN
                         % S SK JrJr  SSKJr  SSKJr  / SQr " S S5      r\" 5       r	\\
S'    " S	 S
5      r " S S5      rS\S\\   4S jrg)    )CallableOptional   )FakeImplHolder)RegistrationHandle)SimpleLibraryRegistrySimpleOperatorEntry	singletonc                   0    \ rS rSrSrS rS\SS4S jrSrg	)
r      a"  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                     0 U l         g N_dataselfs    V/var/www/auris/envauris/lib/python3.13/site-packages/torch/_library/simple_registry.py__init__SimpleLibraryRegistry.__init__   s	    
    qualnamereturnr	   c                 n    XR                   ;  a  [        U5      U R                   U'   U R                   U   $ r   )r   r	   r   r   s     r   findSimpleLibraryRegistry.find   s.    ::%#6x#@DJJx zz(##r   r   N)	__name__
__module____qualname____firstlineno____doc__r   strr   __static_attributes__ r   r   r   r      s     $S $%: $r   r   r
   c                   6    \ rS rSrSrS\4S jr\S 5       rSr	g)r	   '   zxThis is 1:1 to an operator overload.

The fields of SimpleOperatorEntry are Holders where kernels can be
registered to.
r   c                 P    Xl         [        U5      U l        [        U5      U l        g r   )r   r   	fake_implGenericTorchDispatchRuleHoldertorch_dispatch_rulesr   s     r   r   SimpleOperatorEntry.__init__.   s#    %)7)A*84 	!r   c                     U R                   $ r   )r(   r   s    r   abstract_impl!SimpleOperatorEntry.abstract_impl6   s    ~~r   )r(   r   r*   N)
r   r   r   r    r!   r"   r   propertyr-   r#   r$   r   r   r	   r	   '   s'    
 
  r   r	   c                   6    \ rS rSrS rS\S\S\4S jrS r	Sr
g	)
r)   ;   c                     0 U l         Xl        g r   r   r   r   s     r   r   'GenericTorchDispatchRuleHolder.__init__<   s    
 r   torch_dispatch_classfuncr   c                    ^ ^ T R                  T5      (       a  [        T ST R                   35      eUT R                  T'   U U4S jn[	        U5      $ )Nz8 already has a `__torch_dispatch__` rule registered for c                      > T R                   T	 g r   r   r   r5   s   r   
deregister;GenericTorchDispatchRuleHolder.register.<locals>.deregisterI   s    

/0r   )r   RuntimeErrorr   r   r   )r   r5   r6   r:   s   ``  r   register'GenericTorchDispatchRuleHolder.register@   s]     99)**'((`aeanan`op  ,0

'(	1 "*--r   c                 :    U R                   R                  US 5      $ r   )r   getr9   s     r   r   #GenericTorchDispatchRuleHolder.findN   s    zz~~2D99r   r3   N)r   r   r   r    r   typer   r   r=   r   r#   r$   r   r   r)   r)   ;   s)    !.$(.08.	.:r   r)   r5   r   c                 r    [         R                  U R                  5      R                  R                  U5      $ r   )r
   r   r   r*   )opr5   s     r   find_torch_dispatch_rulerE   R   s+    >>"//*??DD r   N)typingr   r   r(   r   utilsr   __all__r   r
   __annotations__r	   r)   rB   rE   r$   r   r   <module>rJ      s_    % % % % H$ $2 $9#:	  : (: :.t @R r   