
    1Vh                         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y)zpMesh summaries and TensorFlow operations to create them.

This file is deprecated. See `summary_v2.py` instead.
    N)metadata)plugin_data_pb2)
summary_v2c           	      d   t        j                  |      }|j                  j                         }|D 	cg c]  }	|	|	nd
 }}	t	        j
                  | ||||||      }
t         j                  j                  j                  j                  t	        j                  | |      ||
|      }|S c c}	w )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.
    )value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   dimtensor_metadatar   s               P/home/dcms/DCMS/lib/python3.12/site-packages/tensorboard/plugins/mesh/summary.py_get_tensor_summaryr        s    > !!/FLL  "E7<=COS+=E=66O YY\\))88""46(	 9 N ! >s   B-c                     || S |S )z0Returns display_name from display_name and name. )r   r   s     r   _get_display_namer#   T   s        c                 <    d}| t        j                  | d      }|S )z6Parses and returns JSON string from python dictionary.z{}T)	sort_keys)jsondumps)config_dictr
   s     r   _get_json_configr*   [   s#    Kjj=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 cg c]  }|j                  | }
}t        j                  |
D cg c]  }|j                   c}      }|
D ]7  }|	j!                  t#        | |||j                  |j                  |||             9 t        j$                  j&                  j(                  j+                  |	||       }|S c c}w c c}w )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.
    )r   r   )r#   r*   r   
MeshTensorr   MeshPluginDataVERTEXr   float32FACEint32COLORuint8dataget_components_bitmaskr   appendr    r   r   r   merge)r   verticesfacescolorsr   r   r   r)   r
   	summariestensorsr   r   all_summariess                 r   opr>   c   sf   B %T<8L";/K
 Io44;;RZZ	
 	?1166	
 	O2288"((	

G %,G&v{{/FvGGG00+23		3J  
##		

 IILL((..{ / M / H 	4s   F&F?F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 
cg c]  }
|
j                  |
 }	}
t        j                  |	D 
cg c]  }
|
j                   c}
      }|	D ]  }
|
j                  j                   }|D cg c]  }||nd
 }}t        j"                  j$                  j'                  |
j                  |
j(                        }t        j*                  | ||
j                  ||||      }t        j,                  | |
j                        }|j/                  |||f        t        j"                  j$                  j1                         }|D ]e  \  }}}t        j"                  j$                  j2                  j5                  |j7                               }|j8                  j;                  |||       g |S c c}
w c c}
w c c}w )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.
    r   )dtyper	   )tagr   r   )r#   r*   r   r,   r   r-   r.   r   r/   r0   r1   r2   r3   r4   r5   r   r   r   r   make_tensor_proto	data_typer   r   r6   SummarySummaryMetadata
FromStringSerializeToStringr   add)r   r8   r9   r:   r   r   r)   r
   r;   r<   r   r   r   r   tensor_protor   rA   r   tf_summary_metadatas                      r   pbrK      s4   < %T<8L";/KIo44;;RZZ	
 	?1166	
 	O2288"((	

G %,G&v{{/FvGGG00+23		3J  @!!;@ACR/AAyy||55KKv// 6 
 $;;#
 ((v/B/BC#/>?!@$ iill""$G/8 
+| iill::EE..0
 	1, 	 	
	
 N= H3 Bs   I6&I6?I;8J )NNNNNN)NNNNN)__doc__r'   
tensorflowr   tensorboard.plugins.meshr   r   r   meshmesh_pbr    r#   r*   r>   rK   r"   r$   r   <module>rQ      ss   
   - 4 / 


1h J` Kr$   