
    9jr                         d dl Z d dlmZ d dlmZ ddlmZmZmZm	Z	m
Z
 ede	j                  dz  fd       Z e       Zer e	j                  e        e	j                          y)    N)cache)cast   )cutedsl_utilsdsl_registryopsregistrytriton_utilsreturnc                  H   t        j                  d      } | sy	 ddl}| j                  dd      \  }}|j	                  |      }t        ||      }t        |      st        |  d      t        t        j                  |      S # t        $ r}t        d|  d      |d}~ww xY w)	ag  
    Get a user-supplied graph-ordering function if specified.

    Pass in a `package.submodule.fn` string to the env variable
    `TORCH_PYTHON_NATIVE_USER_GRAPH_ORDER_FN` that implements the
    calling API described in `torch/_native/README.md`. This function
    must be part of an importable path.

    Return either the imported function or `None`
    'TORCH_PYTHON_NATIVE_USER_GRAPH_ORDER_FNNr   .r   z& does not describe a callable functionzCould not resolve z' into an importable & callable function)osgetenv	importlibrsplitimport_modulegetattrcallable	TypeErrorr   r	   UserOrderingFn	Exception
ValueError)env_varr   module_namefn_namemodulefnes          V/media/conek/DATA/Code/OCR/venv/lib/python3.12/site-packages/torch/_native/__init__.pyget_user_ordering_fnr!   
   s     iiABG  '~~c15W((5VW%|wi'MNOO H++R00  	)PQ
	s   A(B 	B!BB!)r   	functoolsr   typingr    r   r   r   r	   r
   r   r!   user_order_fn!reorder_graphs_from_user_function_register_all_overrides     r    <module>r*      sk    	   G F !h55< ! !H %&.H..}= !     "r)   