o
    ?e                     @   sZ   d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z
 e Z					dd
dZdS )zCProvides a proper python API for the symbols exported through swig.    N)	graph_pb2)
config_pb2)_pywrap_tf_optimizer)clusterT   graph_to_optimizeFc              	   C   s   t | tjstdt| j |dur$t|j| 	 |	 |||}n1t
' t }zt|j| 	 |	 |||}W |  n|  w W d   n1 sPw   Y  t |S )a	  Optimize the provided metagraph.

  For best results, the signature_def field in `metagraph` should be populated
  with information about input (feed) and output (fetch) tensors.

  Args:
    config_proto: a ConfigProto protobuf.
    metagraph: a MetagraphDef protobuf.
    verbose: whether to log optimization results.
    graph_id: a string identifying this graph.
    cluster: a grappler cluster object representing hardware resources
        available to run this graph.
    strip_default_attributes: whether graph node attributes having default
        values should be removed after all the optimization passes. This
        option is useful if the resulting graph will be executed by an older
        process that might not know some of the recently added attributes.
  zCArgument `config_proto` should be a tf.ConfigProto, received type: N)
isinstancer   ZConfigProto	TypeErrortype__name__tf_optZTF_OptimizeGraphZ
tf_clusterZSerializeToString_OPTIMIZE_GRAPH_CLUSTER_LOCKgclusterZClusterZShutdownr   ZGraphDefZ
FromString)Zconfig_protoZ	metagraphverboseZgraph_idr   Zstrip_default_attributesZ	out_graph r   h/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/python/grappler/tf_optimizer.pyOptimizeGraph   s,   	r   )Tr   NF)__doc__	threadingZtensorflow.core.frameworkr   Ztensorflow.core.protobufr   Ztensorflow.python.grapplerr   r   r   r   Lockr   r   r   r   r   r   <module>   s   