
    BVhi                        d Z ddlZddlZddlZddlmZ  edd      5 Z ej                  e      5  ddl	m
Z
 ddd       ddd       dZd Zedk(  r ej                         Zej!                  d	d
d        ej#                  deddd       ej#                  dedd       ej#                  dedd       ej'                         \  ZZ ej*                  eej,                  d   gez          yy# 1 sw Y   xY w# 1 sw Y   xY w)ab  Prints a header file to be used with SELECTIVE_REGISTRATION.

An example of command-line usage is:
  bazel build tensorflow/python/tools:print_selective_registration_header && \
  bazel-bin/tensorflow/python/tools/print_selective_registration_header \
    --graphs=path/to/graph.pb > ops_to_register.h

Then when compiling tensorflow, include ops_to_register.h in the include search
path and pass -DSELECTIVE_REGISTRATION and -DSUPPORT_SELECTIVE_REGISTRATION
 - see core/framework/selective_registration.h for more details.

When compiling for Android:
  bazel build -c opt --copt="-DSELECTIVE_REGISTRATION" \
    --copt="-DSUPPORT_SELECTIVE_REGISTRATION" \
    //tensorflow/tools/android/inference_interface:libtensorflow_inference.so \
    --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
    --crosstool_top=//external:android/crosstool --cpu=armeabi-v7a
    N)appz	/dev/nullw)!selective_registration_header_libc                     t         j                  j                  d      }t        t	        j
                  |t         j                  t         j                               y )N,)FLAGSgraphssplitprintr   
get_headerproto_fileformatdefault_ops)unused_argvr	   s     k/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/tools/print_selective_registration_header.pymainr   2   sB    <<c"&'226383I3I383D3DFG    __main__typeboolc                 (    | j                         dk(  S )Ntrue)lower)vs    r   <lambda>r   <   s    AGGI,? r   z--graphs z<Comma-separated list of paths to model files to be analyzed.T)r   defaulthelprequiredz--proto_fileformatrawprotozFormat of proto file, either textproto, rawproto or ops_list. The ops_list is the file contains the list of ops in JSON format. Ex: "[["Add", "BinaryOp<CPUDevice, functor::add<float>>"]]".)r   r   r   z--default_opsz#NoOp:NoOp,_Recv:RecvOp,_Send:SendOpa$  Default operator:kernel pairs to always include implementation for.Pass "all" to have all operators and kernels included; note that this should be used only when it is useful compared with simply not using selective registration, as it can in some cases limit the effect of compilation caches)r   argv)__doc__argparse
contextlibsysabslr   openfredirect_stdouttensorflow.python.toolsr   r   r   __name__ArgumentParserparserregisteradd_argumentstrparse_known_argsunparsedrunr     r   r   <module>r4      sE  &   
  
+s Hq"<*"<"<Q"? HGH H
 	G z"8""$&//&&"?@I   	A	  B 	3	   ++-/%	#''t388A;-(237 !H H H Hs!   C=C1C=1C:	6C==D