o
    ¶2úhÝ  ã                   @   s   d Z 	ddd„ZdS )zCGraph post-processing logic.

Used by both TensorBoard and mldash.
é   Ú_too_large_attrsc                 C   s    |dur|du rt dƒ‚|dkrt d| ƒ‚|durL| jD ]0}t|j ¡ ƒ}|D ]"}|j|  ¡ }||ks9|dk rJ|j|= |j| jj | d¡¡ q(qdS dS )a  Prepares (modifies in-place) the graph to be served to the front-end.

    For now, it supports filtering out attributes that are
    too large to be shown in the graph UI.

    Args:
      graph: The GraphDef proto message.
      limit_attr_size: Maximum allowed size in bytes, before the attribute
          is considered large. Default is 1024 (1KB). Must be > 0 or None.
          If None, there will be no filtering.
      large_attrs_key: The attribute key that will be used for storing attributes
          that are too large. Default is '_too_large_attrs'. Must be != None if
          `limit_attr_size` is != None.

    Raises:
      ValueError: If `large_attrs_key is None` while `limit_attr_size != None`.
      ValueError: If `limit_attr_size` is defined, but <= 0.
    Nz<large_attrs_key must be != None when limit_attr_size!= None.é    z&limit_attr_size must be > 0, but is %dzutf-8)	Ú
ValueErrorÚnodeÚlistÚattrÚkeysÚByteSizeÚsÚappendÚencode)ÚgraphÚlimit_attr_sizeÚlarge_attrs_keyr   r   ÚkeyÚsize© r   ú\/var/www/html/chatgem/venv/lib/python3.10/site-packages/tensorboard/backend/process_graph.pyÚprepare_graph_for_ui   s.   ÿÿ
ÿ€ùûr   N)r   r   )Ú__doc__r   r   r   r   r   Ú<module>   s   ÿ