
    &Vf                     \    d Z ddlZddlmZ ddlmZ ddlmZ ej        Z	 	 	 	 d	dZ	d
dZ
dS )aH  Image summaries and TensorFlow operations to create them.

An image summary stores the width, height, and PNG-encoded data for zero
or more images in a rank-1 string array: `[w, h, png0, png1, ...]`.

NOTE: This module is in beta, and its API is subject to change, but the
data that it stores to disk will be supported forever.
    N)metadata)
summary_v2)encoder   c           	      <   ddl mc m} || }t          j        ||          }|                    |           5  |                    |                    |d          |                    ||j	                  |
                    |          g          5  |d|         }|                    |j        j        ||j        d          }	|                    |          }
|                    |                    |
d         d	
          |                    |
d         d
          gd
          }|                    ||	gd          }|j                            d|||          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 image summary op for use in a TensorFlow graph.

    Arguments:
      name: A unique name for the generated summary node.
      images: A `Tensor` representing pixel data with shape `[k, h, w, c]`,
        where `k` is the number of images, `h` and `w` are the height and
        width of the images, and `c` is the number of channels, which
        should be 1, 3, or 4. Any of the dimensions may be statically
        unknown (i.e., `None`).
      max_outputs: Optional `int` or rank-0 integer `Tensor`. At most this
        many images will be emitted at each step. When more than
        `max_outputs` many images are provided, the first `max_outputs` many
        images will be used and the rest silently discarded.
      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   encode_each_image)dtypename)input   width)r      height
dimensions)axisimage_summary)r   tensorcollectionssummary_metadata)tensorflow.compat.v1compatv1r   create_summary_metadata
name_scopecontrol_dependenciesassert_rankassert_typeuint8assert_non_negativemap_fnimage
encode_pngstringshapestack	as_stringconcatsummarytensor_summary)r   imagesmax_outputsr	   r
   r   tfr   limited_imagesencoded_imagesimage_shaper   r   s                ^/var/www/html/software/conda/lib/python3.11/site-packages/tensorboard/plugins/image/summary.pyopr5   $   sn   B &%%%%%%%%7!{   
t		 
 
b55NN61%%NN628,,"";//	
  
 
  -H)$	 # 
 
 hhVh,,XX[^'::[^(;;   
 

 J7a@@z(( #-	 ) 
 
/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s7   AFCE9 F9E=	=F E=	FFFc                    ddl mc m} t          j        |                              t          j                  }|j        dk    rt          d|j	        d          |d|         }d |D             }|j	        d         |j	        d         }	}t          |          t          |	          g|z   }
|                    |
|j        	          }|| }t          j        ||
          }|j                            |                                          }|                                }|j                            d| z  ||           |S )a\  Create a legacy image summary protobuf.

    This behaves as if you were to create an `op` with the same arguments
    (wrapped with constant tensors where appropriate) and then execute
    that summary op in a TensorFlow session.

    Arguments:
      name: A unique name for the generated summary, including any desired
        name scopes.
      images: An `np.array` representing pixel data with shape
        `[k, h, w, c]`, where `k` is the number of images, `w` and `h` are
        the width and height of the images, and `c` is the number of
        channels, which should be 1, 3, or 4.
      max_outputs: Optional `int`. At most this many images will be
        emitted. If more than this many images are provided, the first
        `max_outputs` many images will be used and the rest silently
        discarded.
      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   Nr   zShape z must have rank 4c                 6    g | ]}t          j        |          S  )r   r&   ).0r%   s     r4   
<listcomp>zpb.<locals>.<listcomp>   s#    LLLEg(//LLL    r   r   )r   r   z%s/image_summary)tagr   r   )r   r   r   nparrayastyper"   ndim
ValueErrorr(   strmake_tensor_protor'   r   r   SummaryMetadata
FromStringSerializeToStringSummaryvalueadd)r   r.   r/   r	   r
   r0   r1   r2   r   r   contentr   r   tf_summary_metadatar,   s                  r4   pbrL   k   sd   6 &%%%%%%%%Xf$$RX..F{ajFGGGL[L)NLL^LLLN|AQFU5zz3v;;'.8G!!'!;;F7!{   ,77**,,  jjllGM%$    
 Nr;   )r   NNN)r   NN)__doc__numpyr=   tensorboard.plugins.imager   r   tensorboard.utilr   r%   r5   rL   r8   r;   r4   <module>rQ      s         . . . . . . 0 0 0 0 0 0 $ $ $ $ $ $ 	 D
 D
 D
 D
N6 6 6 6 6 6r;   