U
    yh                     @   sF   U d dl mZ dddgZG dd dZe Zeed< G dd dZdS )   )AbstractImplHolderSimpleLibraryRegistrySimpleOperatorEntry	singletonc                   @   s(   e Zd ZdZdd Zeddd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                 C   s
   i | _ d S N)_data)self r	   P/var/www/html/venv/lib/python3.8/site-packages/torch/_library/simple_registry.py__init__   s    zSimpleLibraryRegistry.__init__r   )qualnamereturnc                 C   s"   || j krt|| j |< | j | S r   )r   r   r   r   r	   r	   r
   find   s    
zSimpleLibraryRegistry.findN)__name__
__module____qualname____doc__r   strr   r	   r	   r	   r
   r      s   c                   @   s   e Zd ZdZedddZdS )r   zThis is 1:1 to an operator overload.

    The fields of SimpleOperatorEntry are Holders where kernels can be
    registered to.
    )r   c                 C   s   || _ t|| _d S r   )r   r   abstract_implr   r	   r	   r
   r   *   s    zSimpleOperatorEntry.__init__N)r   r   r   r   r   r   r	   r	   r	   r
   r   #   s   N)r   r   __all__r   r   __annotations__r   r	   r	   r	   r
   <module>   s
    
