
    9ia
                         % 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    ^/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/torch/_library/simple_registry.py__init__SimpleLibraryRegistry.__init__   s	    
    qualnamereturnr	   c                 x    U R                   R                  US 5      nUc  [        U5      =U R                   U'   nU$ r   )r   getr	   )r   r   ress      r   findSimpleLibraryRegistry.find   s8    jjnnXt,;)<X)FFDJJx 3
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_rulesr   r   s     r   r   SimpleOperatorEntry.__init__/   s#    %)7)A*84 	!r   c                     U R                   $ r   )r)   r   s    r   abstract_impl!SimpleOperatorEntry.abstract_impl7   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   r7   s   r   
deregister;GenericTorchDispatchRuleHolder.register.<locals>.deregisterJ   s    

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

'(	1 "*--r   c                 :    U R                   R                  US 5      $ r   )r   r   r;   s     r   r   #GenericTorchDispatchRuleHolder.findO   s    zz~~2D99r   r5   N)r   r   r    r!   r   typer   r   r?   r   r$   r%   r   r   r*   r*   <   s)    !.$(.08.	.:r   r*   r7   r   c                 r    [         R                  U R                  5      R                  R                  U5      $ r   )r
   r   r    r+   )opr7   s     r   find_torch_dispatch_rulerF   S   s+    >>"//*??DD r   N)typingr   r   r)   r   utilsr   __all__r   r
   __annotations__r	   r*   rC   rF   r%   r   r   <module>rK      s_    % % % % H 4 $9#:	  : (: :.t @R r   