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

This file is deprecated. See `summary_v2.py` instead.
    N)metadata)plugin_data_pb2)
summary_v2c           	      0   t          j        |          }|j                                        }d |D             }t	          j        | ||||||          }	t           j        j        j        	                    t	          j
        | |          ||	|          }
|
S )aZ  Creates a tensor summary with summary metadata.

    Args:
      name: Uniquely identifiable name of the summary op. Could be replaced by
        combination of name and type to make it unique even outside of this
        summary.
      display_name: Will be used as the display name in TensorBoard.
        Defaults to `tag`.
      description: A longform readable description of the summary data. Markdown
        is supported.
      tensor: Tensor to display in summary.
      content_type: Type of content inside the Tensor.
      components: Bitmask representing present parts (vertices, colors, etc.) that
        belong to the summary.
      json_config: A string, JSON-serialized dictionary of ThreeJS classes
        configuration.
      collections: List of collections to add this summary to.

    Returns:
      Tensor summary with metadata.
    )valuec                     g | ]}||nd	S N .0dims     ]/var/www/html/software/conda/lib/python3.11/site-packages/tensorboard/plugins/mesh/summary.py
<listcomp>z'_get_tensor_summary.<locals>.<listcomp>A   s     ===COSS===    json_config)summary_metadatacollections)tfconvert_to_tensorshapeas_listr   create_summary_metadatacompatv1summarytensor_summaryget_instance_name)namedisplay_namedescriptiontensorcontent_type
componentsr   r   r   tensor_metadatar   s              r   _get_tensor_summaryr'       s    > !///FL  ""E==u===E6  O Y\)88"466(	 9  N r   c                     || S |S )z0Returns display_name from display_name and name.r   )r    r!   s     r   _get_display_namer)   T   s    r   c                 :    d}| t          j        | d          }|S )z6Parses and returns JSON string from python dictionary.z{}NT)	sort_keys)jsondumps)config_dictr   s     r   _get_json_configr/   [   s'    Kj===r   c                 |   t          | |          }t          |          }g }	t          j        |t          j        j        t          j                  t          j        |t          j        j	        t          j
                  t          j        |t          j        j        t          j                  g}
d |
D             }
t          j        d |
D                       }|
D ]5}|	                    t          | |||j        |j        |||                     6t          j        j        j                            |	||           }|S )a  Creates a TensorFlow summary op for mesh rendering.

    DEPRECATED: see `summary_v2.py` instead.

    Args:
      name: A name for this summary operation.
      vertices: Tensor of shape `[dim_1, ..., dim_n, 3]` representing the 3D
        coordinates of vertices.
      faces: Tensor of shape `[dim_1, ..., dim_n, 3]` containing indices of
        vertices within each triangle.
      colors: Tensor of shape `[dim_1, ..., dim_n, 3]` containing colors for each
        vertex.
      display_name: If set, will be used as the display name in TensorBoard.
        Defaults to `name`.
      description: A longform readable description of the summary data. Markdown
        is supported.
      collections: Which TensorFlow graph collections to add the summary op to.
        Defaults to `['summaries']`. Can usually be ignored.
      config_dict: Dictionary with ThreeJS classes names and configuration.

    Returns:
      Merged summary for mesh/point cloud representation.
    c                      g | ]}|j         	|S Ndatar   r#   s     r   r   zop.<locals>.<listcomp>       GGG&v{/Fv/F/F/Fr   c                     g | ]	}|j         
S r   r$   r5   s     r   r   zop.<locals>.<listcomp>       333	333r   )r   r    )r)   r/   r   
MeshTensorr   MeshPluginDataVERTEXr   float32FACEint32COLORuint8get_components_bitmaskappendr'   r4   r$   r   r   r   merge)r    verticesfacescolorsr!   r"   r   r.   r   	summariestensorsr%   r#   all_summariess                 r   oprK   c   sS   B %T<88L";//K
 Io4;RZ	
 	
 	?16	
 	
 	O28"(	
 	

G HGGGGGG0337333 J  
 
#	 		
 	
 	
 	
 IL(..{ /  M r   c           
         t          | |          }t          |          }g }t          j        |t          j        j        t          j                  t          j        |t          j        j	        t          j
                  t          j        |t          j        j        t          j                  g}	d |	D             }	t          j        d |	D                       }
|	D ]}|j        j        }d |D             }t          j        j                            |j        |j                  }t          j        | ||j        |
|||          }t          j        | |j                  }|                    |||f           t          j        j                                        }|D ]^\  }}}t          j        j        j                            |                                          }|j                            |||           _|S )a8  Create a mesh summary to save in pb format.

    DEPRECATED: see `summary_v2.py` instead.

    Args:
      name: A name for this summary operation.
      vertices: numpy array of shape `[dim_1, ..., dim_n, 3]` representing the 3D
        coordinates of vertices.
      faces: numpy array of shape `[dim_1, ..., dim_n, 3]` containing indices of
        vertices within each triangle.
      colors: numpy array of shape `[dim_1, ..., dim_n, 3]` containing colors for
        each vertex.
      display_name: If set, will be used as the display name in TensorBoard.
        Defaults to `name`.
      description: A longform readable description of the summary data. Markdown
        is supported.
      config_dict: Dictionary with ThreeJS classes names and configuration.

    Returns:
      Instance of tf.Summary class.
    c                      g | ]}|j         	|S r2   r3   r5   s     r   r   zpb.<locals>.<listcomp>   r6   r   c                     g | ]	}|j         
S r   r8   r5   s     r   r   zpb.<locals>.<listcomp>   r9   r   c                     g | ]}||nd	S r	   r   r   s     r   r   zpb.<locals>.<listcomp>   s     AAACRAAAr   )dtyper   )tagr   r#   )r)   r/   r   r:   r   r;   r<   r   r=   r>   r?   r@   rA   rB   r4   r   r   r   make_tensor_proto	data_typer   r$   r   rC   SummarySummaryMetadata
FromStringSerializeToStringr   add)r    rE   rF   rG   r!   r"   r.   r   rH   rI   r%   r#   r   tensor_protor   rQ   r   tf_summary_metadatas                     r   pbr[      s   < %T<88L";//KIo4;RZ	
 	
 	?16	
 	
 	O28"(	
 	

G HGGGGGG0337333 J  @ @!AA5AAAy|55Kv/ 6 
 
 $;#
 
 
 (v/BCC#/>????il""$$G/8 
 
+| il:EE..00
 
 	1, 	 	
 	
 	
 	
 Nr   )NNNNNN)NNNNN)__doc__r,   
tensorflowr   tensorboard.plugins.meshr   r   r   meshmesh_pbr'   r)   r/   rK   r[   r   r   r   <module>ra      s    
      - - - - - - 4 4 4 4 4 4 / / / / / / 

1 1 1h     J J J J` K K K K K Kr   