a
    SicX                     @   s@   d Z ddlmZ ddlmZ ejZejZd	ddZd
ddZdS )z8Text summaries and TensorFlow operations to create them.    )metadata)
summary_v2Nc              	   C   s   ddl m  m} |du r| }tj||d}|| h ||||jg2 |j	j
d|||dW  d   W  d   S 1 s0    Y  W d   n1 s0    Y  dS )a  Create a legacy text summary op.

    Text data summarized via this plugin will be visible in the Text Dashboard
    in TensorBoard. The standard TensorBoard Text Dashboard will render markdown
    in the strings, and will automatically organize 1D and 2D tensors into tables.
    If a tensor with more than 2 dimensions is provided, a 2D subarray will be
    displayed along with a warning message. (Note that this behavior is not
    intrinsic to the text summary API, but rather to the default TensorBoard text
    plugin.)

    Args:
      name: A name for the generated node. Will also serve as a series name in
        TensorBoard.
      data: A string-type Tensor to summarize. The text must be encoded in UTF-8.
      display_name: Optional name for this summary in TensorBoard, as a
        constant `str`. Defaults to `name`.
      description: Optional long-form description for this summary, as a
        constant `str`. Markdown is supported. Defaults to empty.
      collections: Optional list of ops.GraphKeys. The collections to which to add
        the summary. Defaults to [Graph Keys.SUMMARIES].

    Returns:
      A TensorSummary op that is configured so that TensorBoard will recognize
      that it contains textual data. The TensorSummary is a scalar `Tensor` of
      type `string` which contains `Summary` protobufs.

    Raises:
      ValueError: If tensor has the wrong type.
    r   Ndisplay_namedescriptionZtext_summary)nametensorcollectionssummary_metadata)tensorflow.compat.v1compatv1r   create_summary_metadata
name_scopecontrol_dependenciesassert_typestringsummarytensor_summary)r   datar   r   r	   tfr
    r   \/var/www/html/django/DPS/env/lib/python3.9/site-packages/tensorboard/plugins/text/summary.pyop   s    r   c           
   
   C   s   ddl m  m} z|j||jd}W n, tyR } zt|W Y d}~n
d}~0 0 |du r`| }tj||d}|j	
| }| }	|	jjd|  ||d |	S )ay  Create a legacy text summary protobuf.

    Arguments:
      name: A name for the generated node. Will also serve as a series name in
        TensorBoard.
      data: A Python bytestring (of type bytes), or Unicode string. Or a numpy
        data array of those types.
      display_name: Optional name for this summary in TensorBoard, as a
        `str`. Defaults to `name`.
      description: Optional long-form description for this summary, as a
        `str`. Markdown is supported. Defaults to empty.

    Raises:
      ValueError: If the type of the data is unsupported.

    Returns:
      A `tf.Summary` protobuf object.
    r   N)dtyper   z%s/text_summary)tagr   r   )r   r   r   make_tensor_protor   	TypeError
ValueErrorr   r   SummaryMetadata
FromStringSerializeToStringSummaryvalueadd)
r   r   r   r   r   r   er
   tf_summary_metadatar   r   r   r   pbK   s(    r'   )NNN)NN)__doc__tensorboard.plugins.textr   r   texttext_pbr   r'   r   r   r   r   <module>   s   
0