
    &VfE                     R    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 d	dZd
dZdS )zEText summaries and TensorFlow operations to create them, V2 versions.    N)tf2)summary_pb2)metadata)tensor_utilc                    t          j        d|          }t          t          j        j        dd          pt          j        j        } || d||g          5 \  }}t          j                            |t          j	                   t          j        
                    ||||          cddd           S # 1 swxY w Y   dS )am	  Write a text summary.

    See also `tf.summary.scalar`, `tf.summary.SummaryWriter`, `tf.summary.image`.

    Writes text Tensor values for later visualization and analysis in TensorBoard.
    Writes go to the current default summary writer.  Like `tf.summary.scalar`
    points, text points are each associated with a `step` and a `name`.
    All the points with the same `name` constitute a time series of text values.

    For Example:
    ```python
    test_summary_writer = tf.summary.create_file_writer('test/logdir')
    with test_summary_writer.as_default():
        tf.summary.text('first_text', 'hello world!', step=0)
        tf.summary.text('first_text', 'nice to meet you!', step=1)
    ```

    The text summary can also contain Markdown, and TensorBoard will render the text
    as such.

    ```python
    with test_summary_writer.as_default():
        text_data = '''
              | *hello* | *there* |
              |---------|---------|
              | this    | is      |
              | a       | table   |
        '''
        text_data = '\n'.join(l.strip() for l in text_data.splitlines())
        tf.summary.text('markdown_text', text_data, step=0)
    ```

    Since text is Tensor valued, each text point may be a Tensor of string values.
    rank-1 and rank-2 Tensors are rendered as tables in TensorBoard.  For higher ranked
    Tensors, you'll see just a 2D slice of the data.  To avoid this, reshape the Tensor
    to at most rank-2 prior to passing it to this function.

    Demo notebook at
    ["Displaying text data in TensorBoard"](https://www.tensorflow.org/tensorboard/text_summaries).

    Arguments:
      name: A name for this summary. The summary tag used for TensorBoard will
        be this name prefixed by any active name scopes.
      data: A UTF-8 string Tensor value.
      step: Explicit `int64`-castable monotonic step value for this summary. If
        omitted, this defaults to `tf.summary.experimental.get_step()`, which must
        not be None.
      description: Optional long-form description for this summary, as a
        constant `str`. Markdown is supported. Defaults to empty.

    Returns:
      True on success, or false if no summary was emitted because no default
      summary writer was available.

    Raises:
      ValueError: if a default writer exists, but no step was provided and
        `tf.summary.experimental.get_step()` is None.
    Ndisplay_namedescriptionsummary_scopetext_summary)values)tagtensorstepr   )r   create_summary_metadatagetattrtfsummaryexperimentalr   	debuggingassert_typestringwrite)namedatar   r
   summary_metadatar   r   _s           `/var/www/html/software/conda/lib/python3.11/site-packages/tensorboard/plugins/text/summary_v2.pytextr      s
   v  7{  
 	
'$?? 	$:#  
t^T4L	A	A	A 
Xc1
  ry111zDt6F   
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   AB55B9<B9c                    	 t          j        |t          j                  }n"# t          $ r}t	          d|          d}~ww xY wt          j        d|          }t          j                    }|j	        
                    | ||           |S )a  Create a text tf.Summary protobuf.

    Arguments:
      tag: String tag for the summary.
      data: A Python bytestring (of type bytes), a Unicode string, or a numpy data
        array of those types.
      description: Optional long-form description for this summary, as a `str`.
        Markdown is supported. Defaults to empty.

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

    Returns:
      A `tf.Summary` protobuf object.
    )dtypeztensor must be of type stringNr   )r   r   r   )r   make_tensor_protonpobject_	TypeErrorr   r   r   Summaryvalueadd)r   r   r
   r   er   r   s          r   text_pbr*   d   s     <.t2:FFF < < <7;;;<7{   !##GM#(8HHHNs    # 
A=A)NN)N)__doc__numpyr#   tensorboard.compatr   r   tensorboard.compat.protor   tensorboard.plugins.textr   tensorboard.utilr   r   r*        r   <module>r3      s    L K     ( ( ( ( ( ( 0 0 0 0 0 0 - - - - - - ( ( ( ( ( (G
 G
 G
 G
T     r2   