a
    Sic                     @   sb   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 dej	Z
G d	d
 d
e
ZdS )zEGeneralized output options for writing tensor-formatted summary data.    )	event_pb2)summary_pb2)event_file_writer)tensor_utilNc                   @   sB   e Zd ZdZejdddddZejdd Zejdd	 ZdS )
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                C   s   dS )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	   r
   r
   W/var/www/html/django/DPS/env/lib/python3.9/site-packages/tensorboard/summary/_output.pyemit_scalar$   s    zOutput.emit_scalarc                 C   s   dS )z(Flushes any data that has been buffered.Nr
   r   r
   r
   r   flushC   s    zOutput.flushc                 C   s   dS )z5Closes the Output and also flushes any buffered data.Nr
   r   r
   r
   r   closeH   s    zOutput.close)	__name__
__module____qualname____doc__abcabstractmethodr   r   r   r
   r
   r
   r   r      s   
	
r   c                   @   s8   e Zd ZdZdd ZdddddZdd	 Zd
d ZdS )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                 C   s   t || _dS )z/Creates a `DirectoryOutput` for the given path.N)r   EventFileWriter
_ev_writer)r   pathr
   r
   r   __init__U   s    zDirectoryOutput.__init__Nr   c                C   s\   t jt jj||d|t jjd}t|}	tj||d}
|
j	j
j||	|d | j|
 dS )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eventr
   r
   r   r   Y   s    
zDirectoryOutput.emit_scalarc                 C   s   | j   dS r!   N)r   r   r   r
   r
   r   r   t   s    zDirectoryOutput.flushc                 C   s   | j   dS r5   )r   r   r   r
   r
   r   r   x   s    zDirectoryOutput.close)r   r   r   r   r    r   r   r   r
   r
   r
   r   r   N   s   r   )r   tensorboard.compat.protor   r   Ztensorboard.summary.writerr   tensorboard.utilr   r   ABCr   r   r
   r
   r
   r   <module>   s   5