
    &Vf                     V    d Z ddlZddlmZ ddlmZ ej        Zej        ZddZddZ	dS )	zScalar summaries and TensorFlow operations to create them.

A scalar summary stores a single floating-point value, as a rank-0
tensor.
    N)metadata)
summary_v2c           	         ddl mc m} || }t          j        ||          }|                    |           5  |                    |                    |          g          5  |j        	                    d|
                    ||j                  ||          cddd           cddd           S # 1 swxY w Y   	 ddd           dS # 1 swxY w Y   dS )a  Create a legacy scalar summary op.

    Arguments:
      name: A unique name for the generated summary node.
      data: A real numeric rank-0 `Tensor`. Must have `dtype` castable
        to `float32`.
      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 graph collections keys. The new
        summary op is added to these collections. Defaults to
        `[Graph Keys.SUMMARIES]`.

    Returns:
      A TensorFlow summary op.
    r   Ndisplay_namedescriptionscalar_summary)nametensorcollectionssummary_metadata)tensorflow.compat.v1compatv1r   create_summary_metadata
name_scopecontrol_dependenciesassert_scalarsummarytensor_summarycastfloat32)r
   datar   r   r   tfr   s          _/var/www/html/software/conda/lib/python3.11/site-packages/tensorboard/plugins/scalar/summary.pyopr   !   s   & &%%%%%%%%7!{   
t		  $$b&6&6t&<&<%=>> 	 	:,,%wwtRZ00'!1	 -  	 	 	 	 	 	 	       	 	 	 	 	 	 	 	 	                 s5   *C#7B3C3B7	7C:B7	;CCCc                 0   ddl mc m} t          j        |          }|j        dk    rt          d|j        z            |j        j        dvrt          d|j        j	        z            |
                    |                    t          j                            }|| }t          j        ||          }|j                            |                                          }|                                }|j                            d| z  ||	           |S )
a%  Create a legacy scalar summary protobuf.

    Arguments:
      name: A unique name for the generated summary, including any desired
        name scopes.
      data: A rank-0 `np.array` or array-like form (so raw `int`s and
        `float`s are fine, too).
      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.

    Returns:
      A `tf.Summary` protobuf object.
    r   N z.Expected scalar shape for data, saw shape: %s.)biufz!Cast %s to float is not supportedr   z%s/scalar_summary)tagr   r   )r   r   r   nparrayshape
ValueErrordtypekindr
   make_tensor_protoastyper   r   r   SummaryMetadata
FromStringSerializeToStringSummaryvalueadd)	r
   r   r   r   r   r   r   tf_summary_metadatar   s	            r   pbr3   E   s5   " &%%%%%%%%8D>>DzR<tzI
 
 	
 z222<tzNOOO!!$++bj"9"9::F7!{   ,77**,,  jjllGM$&$    
 N    )NNN)NN)
__doc__numpyr$   tensorboard.plugins.scalarr   r   scalar	scalar_pbr   r3   r   r4   r   <module>r:      s         / / / / / / 1 1 1 1 1 1 
	 	! ! ! !H* * * * * *r4   