U
    VcF                     @   s2   d Z ddlmZ ddlmZ d	ddZdd ZdS )
zFContains summaries related to laying out the custom scalars dashboard.    )
layout_pb2)metadataNc                 C   sP   ddl m  m} t| tjs"tt }|j	j
tj|j|  |jd||dS )a  Creates a summary that contains a layout.

    When users navigate to the custom scalars dashboard, they will see a layout
    based on the proto provided to this function.

    Args:
      scalars_layout: The scalars_layout_pb2.Layout proto that specifies the
          layout.
      collections: Optional list of graph collections keys. The new
          summary op is added to these collections. Defaults to
          `[Graph Keys.SUMMARIES]`.

    Returns:
      A tensor summary op that writes the layout to disk.
    r   NZdtype)nametensorcollectionssummary_metadata)tensorflow.compat.v1compatv1
isinstancer   LayoutAssertionErrorr   create_summary_metadatasummaryZtensor_summaryCONFIG_SUMMARY_TAGZconstantSerializeToStringstring)scalars_layoutr   tfr    r   M/tmp/pip-unpacked-wheel-g8kmtpbc/tensorboard/plugins/custom_scalar/summary.pyop   s    r   c                 C   sj   ddl m  m} t| tjs"t|j|  |j	d}|j
t  }| }|jjtj||d |S )aV  Creates a summary that contains a layout.

    When users navigate to the custom scalars dashboard, they will see a layout
    based on the proto provided to this function.

    Args:
      scalars_layout: The scalars_layout_pb2.Layout proto that specifies the
          layout.

    Returns:
      A summary proto containing the layout.
    r   Nr   )tagr   r   )r	   r
   r   r   r   r   r   Zmake_tensor_protor   r   ZSummaryMetadataZ
FromStringr   r   ZSummaryvalueaddr   )r   r   r   Ztf_summary_metadatar   r   r   r   pb3   s      
r   )N)__doc__Z!tensorboard.plugins.custom_scalarr   r   r   r   r   r   r   r   <module>   s   
