Ë
    Ÿ‘ij
  ã                   ó„   — d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z
  G d„ de«      Zej                  	 	 	 	 d
d	„«       Zy)z)A python interface for Grappler clusters.é    N)Ústep_stats_pb2)Úop_performance_data_pb2)Údevice_properties_pb2)Ú_pywrap_tf_clusterc                   ó`   — e Zd ZdZ	 	 	 	 dd„Zd„ Zd„ Zed„ «       Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zy)ÚClusterzGrappler Clusters.Nc                 óÖ   — d| _         | | _        |€t        j                  ||«      | _         y|D �cg c]  }|j	                  «       ‘Œ }}t        j
                  |«      | _         yc c}w )a  Creates a Cluster.

    Args:
      allow_soft_placement: If True, TF will automatically fix illegal
        placements instead of erroring out if the placement isn't legal.
      disable_detailed_stats: If True, detailed statistics will not be
        available.
      disable_timeline: If True, the timeline information will not be reported.
      devices: A list of devices of type device_properties_pb2.NamedDevice.
        If None, a device list will be created based on the spec of
        the local machine.
    N)Ú_tf_clusterÚ_generate_timelineÚ
tf_clusterÚTF_NewClusterÚSerializeToStringÚTF_NewVirtualCluster)ÚselfÚallow_soft_placementÚdisable_detailed_statsÚdisable_timelineÚdevicesÚdeviceÚdevices_serializeds          úw/var/www/html/emotional.easysim.app/public_html/venv/lib/python3.12/site-packages/tensorflow/python/grappler/cluster.pyÚ__init__zCluster.__init__   sq   € ð" €DÔØ"2Ð2€DÔà€Ü#×1Ñ1Ð2FØ2HóJ€dÕð FMÖM¸6˜F×4Ñ4Õ6ÐMÐÐMÜ#×8Ñ8Ð9KÓL€dÕùò Ns   ²A&c                 ój   — | j                   �'t        j                  | j                   «       d | _         y y ©N)r
   r   ÚTF_ShutdownCluster©r   s    r   ÚShutdownzCluster.Shutdown7   s/   € Ø×ÑÐ#Ü×#Ñ# D×$4Ñ$4Ô5Ø€dÕð $ó    c                 ó$   — | j                  «        y r   )r   r   s    r   Ú__del__zCluster.__del__<   s   € Ø‡M�M…Or   c                 ó   — | j                   S r   )r
   r   s    r   r   zCluster.tf_cluster?   s   € à×ÑÐr   c                 ó¼   — | j                   €g S t        j                  | j                   «      D �cg c]!  }t        j                  j                  |«      ‘Œ# c}S c c}w )z-Returns a list of available hardware devices.)r
   r   ÚTF_ListDevicesr   ÚNamedDeviceÚ
FromString©r   r   s     r   ÚListDeviceszCluster.ListDevicesC   sY   € à×ÑÐØ€iä$×3Ñ3°D×4DÑ4DÓEöGØô "×-Ñ-×8Ñ8¸Õ@ò Gð Gùò Gs   °&Ac                 ó*   — t        j                  «       S )zCReturns a list of all available operations (sorted alphabetically).)r   ÚTF_ListAvailableOpsr   s    r   ÚListAvailableOpszCluster.ListAvailableOpsJ   s   € ä×)Ñ)Ó+Ð+r   c                 óV   — t        j                  | j                  |j                  «      S r   )r   ÚTF_GetSupportedDevicesr
   Útf_item©r   Úitems     r   ÚGetSupportedDeviceszCluster.GetSupportedDevicesN   s   € Ü×,Ñ,¨T×-=Ñ-=¸t¿|¹|ÓLÐLr   c                 óH   — t        j                  |j                  «       «      S r   )r   ÚTF_EstimatePerformancer   r&   s     r   ÚEstimatePerformancezCluster.EstimatePerformanceQ   s   € Ü×,Ñ,¨V×-EÑ-EÓ-GÓHÐHr   c                 ó  — t        j                  |j                  | j                  | j                  «      \  }}}|D �cg c]!  }t
        j                  j                  |«      ‘Œ# }}||t        j                  j                  |«      fS c c}w )z¬Returns the cost of running the specified item.

    Args:
      item: The item for which to measure the costs.
    Returns: The triplet op_perfs, runtime, step_stats.
    )
r   ÚTF_MeasureCostsr-   r
   r   r   ÚOpPerformancer%   r   Ú	StepStats)r   r/   Úop_perf_bytes_listÚrun_timeÚstep_stats_bytesÚop_perf_bytesÚop_perfss          r   ÚMeasureCostszCluster.MeasureCostsT   s‘   € ô 6@×5OÑ5OØ�‰�d×&Ñ&¨×(?Ñ(?ó6AÑ2Ð˜Ð"2ð &8ö9Ø!ô (×5Ñ5×@Ñ@ÀÕOð 9€Hð 9à�hÜ×$Ñ$×/Ñ/Ð0@ÓAðCð Cùò9s   ¾&Bc                 óV   — t        j                  |j                  | j                  «      S )z¢Returns a snapshot of the peak memory usage.

    Args:
      item: The item for which to measure the costs.
    Returns: A hashtable indexed by device name.
    )r   ÚTF_DeterminePeakMemoryUsager-   r
   r.   s     r   ÚDeterminePeakMemoryUsagez Cluster.DeterminePeakMemoryUsagec   s(   € ô ×1Ñ1°$·,±,Ø26×2BÑ2BóDð Dr   ©TTTN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r    Úpropertyr   r'   r*   r0   r3   r=   r@   © r   r   r   r      sZ   „ Ùð %)Ø&*Ø $Øó	Mò6ò
ð ñó ðòGò,òMòIòCóDr   r   c              #   óP   K  — t        | |||«      }|–— |j                  «        y ­wr   )r   r   )r   r   r   r   Úclusters        r   Ú	ProvisionrJ   n   s.   è ø€ ô
 Ð(Ð*@Ø$ gó/€'à‚-Ø	×ÑÕùs   ‚$&rA   )rE   Ú
contextlibÚtensorflow.core.frameworkr   Útensorflow.core.grappler.costsr   Útensorflow.core.protobufr   Útensorflow.python.grapplerr   r   Úobjectr   ÚcontextmanagerrJ   rG   r   r   ú<module>rR      sP   ðñ 0ã å 4Ý BÝ :Ý GôRDˆfô RDðj ×ÑØ#'Ø%)Ø#Øòó ñr   