
    Bh                     X    d Z ddlZddlZdZ ej                  dddg      Zd Zd Zd	 Zy)
z2Common values and methods for TensorFlow Debugger.    Nzgrpc://RunKey
feed_namesfetch_namesc                 H    t        | d      r| j                  S t        |       S )a  Obtain the name or string representation of a graph element.

  If the graph element has the attribute "name", return name. Otherwise, return
  a __str__ representation of the graph element. Certain graph elements, such as
  `SparseTensor`s, do not have the attribute "name".

  Args:
    elem: The graph element in question.

  Returns:
    If the attribute 'name' is available, return the name. Otherwise, return
    str(fetch).
  name)hasattrr   str)elems    \/var/www/html/engine/venv/lib/python3.12/site-packages/tensorflow/python/debug/lib/common.pyget_graph_element_namer      s      dF+:T:    c                    g }t        | t        t        f      r#| D ]  }|j                  t	        |              |S t        | t
              r&| D ]  }|j                  t	        | |                ! |S |j                  t        |              |S )a~  Get a flattened list of the names in run() call feeds or fetches.

  Args:
    feeds_or_fetches: Feeds or fetches of the `Session.run()` call. It maybe
      a Tensor, an Operation or a Variable. It may also be nested lists, tuples
      or dicts. See doc of `Session.run()` for more details.

  Returns:
    (list of str) A flattened list of fetch names from `feeds_or_fetches`.
  )
isinstancelisttupleextendget_flattened_namesdictappendr   )feeds_or_fetcheslinesitemkeys       r   r   r   +   s     % 4-0  .ll&t,-. 
, "D) ?ll&'7'<=>? 
, 
LL'(89:	,r   c                 d    t        j                  t        t        |       t        |                  S )a  Summarize the names of feeds and fetches as a RunKey JSON string.

  Args:
    feed_dict: The feed_dict given to the `Session.run()` call.
    fetches: The fetches from the `Session.run()` call.

  Returns:
    A JSON Array consisting of two items. They first items is a flattened
    Array of the names of the feeds. The second item is a flattened Array of
    the names of the fetches.
  )jsondumpsr   r   )	feed_dictfetchess     r   get_run_keyr   F   s,     
F.y9.w79 
: :r   )	__doc__collectionsr   GRPC_URL_PREFIX
namedtupler   r   r   r    r   r   <module>r%      s?    9   
 		<*G	H;$6:r   