B
    #=6\                 @   sr   d dl mZ d dl mZ d dl mZ d dl mZ d dlZd dlZd dlmZm	Z	 dd Z
e Zd	d
 Zdd ZdS )    )absolute_import)division)print_function)unicode_literalsN)coreextension_loaderc             C   s*   t j| std|  dS t|  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)ospathexistsprintformat
_init_impl)name r   7/tmp/pip-install-l3r2oljg/torch/caffe2/python/dyndep.pyInitOpsLibrary   s    r   c               C   s   t S )N)_IMPORTED_DYNDEPSr   r   r   r   GetImportedOpsLibraries)   s    r   c          	   C   s4   t |  t  t|  W d Q R X t  d S )N)r   addr   ZDlopenGuardctypesCDLLr   ZRefreshRegisteredOperators)r	   r   r   r   r   -   s    

r   )
__future__r   r   r   r   r   r   Zcaffe2.pythonr   r   r   setr   r   r   r   r   r   r   <module>   s   