o
    i                  	   @   s  d dl Z d dlZd dlZd dlZdZzd dlZW n eefy#   Y nw dZdZd	 dkr0dZesej
dreeejd	d Zd
d Zde ddde ddgde ddde ddgdgdgdd ZeD ]ZeeZesuqlejes}J e e ql[[ddlT dZdd Zdd Zee_dd e_ee_ee_ee _ee _ee!_ee!_ee"_ee"_ddksddkree#_ee#_ee$_ee$_ee%_ee%_ee&_ee&_ej'e(_'ej'j)* D ]
\Z+Z,e-e(e+e, qdd Z.d d! Z/d"d# Z0e1d$d e2_3dS )%    NFT nvinfertensorrt_rtx_14winTRT_LOG_FOUND_DLLSc                 C   s   t jd t jj}|t jt jtt j	d |D ]}t j|| }t j
|r;tr7td|  d|  |  S q	 | drDd S td| |)	NPATHztensorrt.libszFound z
 in path: Fnvinfer_pluginnvinfer_builder_resourcezGCould not find: {:}. Is it on your PATH?
Note: Paths searched were:
{:})osenvironsplitpathpathsepappendjoindirname__file__pardirisfilelog_found_dllsprint
startswithFileNotFoundErrorformat)namepathsr   libpath r   N/home/ubuntu/.local/lib/python3.10/site-packages/tensorrt_bindings/__init__.pyfind_lib(   s    

r    
nvinfer_10z.dllznvinfer_plugin_10.dllnvonnxparser_10znvinfer_builder_resource_10.dllznvinfer_dispatch_10.dllznvinfer_lean_10.dll)tensorrtr   tensorrt_dispatchtensorrt_leanr#      )*z10.14.1.48.post1c                 C   s   t dt | S )NzzContext managers for TensorRT types are deprecated. Memory will be freed automatically when the reference count reaches 0.)warningswarnDeprecationWarningthisr   r   r   common_enterf   s
   r-   c                 C   s   dS )z
    Context managers are deprecated and have no effect. Objects are automatically freed when
    the reference count reaches 0.
    Nr   r,   exc_type	exc_value	tracebackr   r   r   common_exito   s   r2   c                 C   s   d S Nr   r.   r   r   r   <lambda>y   s    r4   c                 C   s   d}| D ]}||9 }q|S )a  
    Computes the volume of an iterable.

    :arg iterable: Any python iterable, including a :class:`Dims` object.

    :returns: The volume of the iterable. This will return 1 for empty iterables, as a scalar has an empty shape and the volume of a tensor with empty shape is 1.
    r&   r   )iterablevolelemr   r   r   volume   s   
r8   c                 C   sN   ddl }t|jt|jt|jt|jt|jt|jt|ji}| |v r#||  S t	d)z
    Returns the numpy-equivalent of a TensorRT :class:`DataType` .

    :arg trt_type: The TensorRT data type to convert.

    :returns: The equivalent numpy type.
    r   NzDCould not resolve TensorRT datatype to an equivalent numpy datatype.)
numpyfloat32float16int8int32int64boolbool_uint8	TypeError)trt_typenpmappingr   r   r   nptype   s   
rF   c                 C   sD   t dtdtdtdtdtdtdtdtdt	dt
di}| |v r ||  S dS )z
    Returns the size in bytes of this :class:`DataType`.
    The returned size is a rational number, possibly a `Real` denoting a fraction of a byte.

    :arg trt_type: The TensorRT data type.

    :returns: The size of the type.
          r&      g      ?N)r:   r;   bfloat16r<   r=   r>   r?   rA   fp8int4fp4)rC   rE   r   r   r   	_itemsize   s   
rN   c                 C   s   t | S r3   )rN   r+   r   r   r   r4      s    )4ctypesr   sysr(   _libs_wheel_importedtensorrt_libsImportErrorModuleNotFoundError_trt_lib_suffixstripplatformr   r?   intr   getr   r    	LIBRARIESliblib_pathr   r   CDLLr#   __version__r-   r2   ILogger	__enter____exit__ICudaEngineIExecutionContextRuntimeIHostMemoryBuilderINetworkDefinition
OnnxParserIBuilderConfigSeverityLogger__members__itemsattrvaluesetattrr8   rF   rN   propertyDataTypeitemsizer   r   r   r   <module>   s   



		
