a
    ==ic                     @   sX   d dl Z d dlZd dlmZ d dlmZmZ dddZe Z	e Z
dd Zdd	d
ZdS )    N)Lock)coreextension_loaderTc                 C   s.   t j| std|  dS t| |d dS )aO  Loads a dynamic library that contains custom operators into Caffe2.

    Since Caffe2 uses static variable registration, you can optionally load a
    separate .so file that contains custom operators and registers that into
    the caffe2 core binary. In C++, this is usually done by either declaring
    dependency during compilation time, or via dynload. This allows us to do
    registration similarly on the Python side.

    Args:
        name: a name that ends in .so, such as "my_custom_op.so". Otherwise,
            the command will simply be ignored.
    Returns:
        None
    z&Ignoring {} as it is not a valid file.N)trigger_lazy)ospathexistsprintformat
_init_impl)namer    r   e/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/caffe2/python/dyndep.pyInitOpsLibrary   s    r   c                   C   s   t S N)_IMPORTED_DYNDEPSr   r   r   r   GetImportedOpsLibraries*   s    r   c              	   C   sn   t V t|  t  t|  W d    n1 s80    Y  t| W d    n1 s`0    Y  d S r   )	dll_lockr   addr   ZDlopenGuardctypesCDLLr   ZRefreshRegisteredOperators)r   r   r   r   r   r   .   s
    

(r   )T)T)r   r   	threadingr   Zcaffe2.pythonr   r   r   setr   r   r   r   r   r   r   r   <module>   s   
