
    1Vh                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZ G d dej                        Z
 G d	 d
e
      Zy)zEGeneralized output options for writing tensor-formatted summary data.    )	event_pb2)summary_pb2)event_file_writer)tensor_utilNc                       e Zd ZdZej
                  dddd       Zej
                  d        Zej
                  d        Zy)Outputag  Interface for emitting tensor-formatted summary data.

    Implementations of this interface can be passed to Writer to customize
    how summary data is actually persisted (e.g. to disk, to memory, over
    the network, etc.).

    TODO(#4581): This API should be considered EXPERIMENTAL and subject to
    backwards-incompatible changes without notice.
    Ntag_metadatadescriptionc                     y)a  Emits one scalar data point to this Output.

        Args:
          plugin_name: string name to uniquely identify the type of time series
            (historically associated with a TensorBoard plugin).
          tag: string tag used to uniquely identify this time series.
          data: `np.float32` scalar value for this data point.
          step: `np.int64` scalar step value for this data point.
          wall_time: `float` seconds since the Unix epoch, representing the
            real-world timestamp for this data point.
          tag_metadata: optional bytes containing metadata for this entire time
            series. This should be constant for a given tag; only the first
            value encountered will be used.
          description: optional string description for this entire time series.
            This should be constant for a given tag; only the first value
            encountered will be used.
        N )selfplugin_nametagdatastep	wall_timer
   r   s           K/home/dcms/DCMS/lib/python3.12/site-packages/tensorboard/summary/_output.pyemit_scalarzOutput.emit_scalar$   s    : 	    c                      y)z(Flushes any data that has been buffered.Nr   r   s    r   flushzOutput.flushC        	r   c                      y)z5Closes the Output and also flushes any buffered data.Nr   r   s    r   closezOutput.closeH   r   r   )	__name__
__module____qualname____doc__abcabstractmethodr   r   r   r   r   r   r   r      s]     	  < 	  	 r   r   c                   0    e Zd ZdZd ZddddZd Zd Zy)DirectoryOutputzOutputs summary data by writing event files to a log directory.

    TODO(#4581): This API should be considered EXPERIMENTAL and subject to
    backwards-incompatible changes without notice.
    c                 8    t        j                  |      | _        y)z/Creates a `DirectoryOutput` for the given path.N)r   EventFileWriter
_ev_writer)r   paths     r   __init__zDirectoryOutput.__init__U   s    +;;DAr   Nr	   c                   t        j                  t         j                  j                  ||      |t         j                  j                        }t        j                  |      }	t        j                  ||      }
|
j                  j                  j                  ||	|       | j                  j                  |
       y)See `Output`.)r   content)plugin_datasummary_description
data_class)r   r   )r   tensormetadataN)r   SummaryMetadata
PluginData	DataClassDATA_CLASS_SCALARr   make_tensor_protor   Eventsummaryvalueaddr'   	add_event)r   r   r   r   r   r   r
   r   summary_metadatatensor_protoevents              r   r   zDirectoryOutput.emit_scalarY   s     '66#33>>' ?  !,",,>>
 #44T:)$?L3C 	  	
 	!!%(r   c                 8    | j                   j                          yr+   N)r'   r   r   s    r   r   zDirectoryOutput.flusht   s    r   c                 8    | j                   j                          yr@   )r'   r   r   s    r   r   zDirectoryOutput.closex   s     	r   )r   r   r   r    r)   r   r   r   r   r   r   r$   r$   N   s$    B )6  r   r$   )r    tensorboard.compat.protor   r   tensorboard.summary.writerr   tensorboard.utilr   r!   ABCr   r$   r   r   r   <module>rF      s7    L . 0 8 ( 
2SWW 2j. f . r   