
    BVh                     T    d Z ddlZddlmZ ddlmZ  ed       G d de             Zy)zTPU hardware feature info.    N)topology_pb2)	tf_exportz tpu.experimental.HardwareFeaturec                   p    e Zd ZdZd Z G d dej                        Zed        Z	e
d        Ze
d        Zy)	HardwareFeaturez/class holds all the feature info about the TPU.c                     || _         y)zStore TPU hardware feature info.

    Args:
      tpu_hardware_feature_proto: protobuf which describe the tpu hardware
        feature.
    N)tpu_hardware_feature_proto)selfr   s     Z/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/tpu/tpu_hardware_feature.py__init__zHardwareFeature.__init__   s     'AD#    c                       e Zd ZdZdZdZdZy) HardwareFeature.EmbeddingFeaturea  Embedding feature flag strings.

    UNSUPPORTED: No embedding lookup accelerator available on the tpu.
    V1: Embedding lookup accelerator V1. The embedding lookup operation can only
        be placed at the beginning of computation. Only one instance of
        embedding
        lookup layer is allowed.
    V2: Embedding lookup accelerator V2. The embedding lookup operation can be
        placed anywhere of the computation. Multiple instances of embedding
        lookup layer is allowed.
    UNSUPPORTEDV1V2N)__name__
__module____qualname____doc__r   r   r    r   r
   EmbeddingFeaturer   "   s    
  K	B	Br   r   c                    t         j                  j                  j                  t        j                  j                  t         j                  j                  j
                  t        j                  j
                  t         j                  j                  j                  t        j                  j                  i}|j                  |t        j                  j                        S )z3Convert the embedding feature proto to enum string.)r   TPUHardwareFeaturer   r   r   r   r   get)clsembedding_feature_proto%embedding_feature_proto_to_string_maps      r
   "_embedding_feature_proto_to_stringz2HardwareFeature._embedding_feature_proto_to_string2   s     	''88DD,,88''88;;,,//''88;;,,//-) 144!A!A!M!MO Or   c                 T    t         j                  | j                  j                        S )zITPU embedding feature.

    Returns:
      An EmbeddingFeature enum.
    )r   r   r   embedding_featurer	   s    r
   r    z!HardwareFeature.embedding_feature@   s&     ==''99; ;r   c                 .    | j                   j                  S )zpNumber of embedding accelerator devices per chip.

    Returns:
      Number of embedding devices per chip.
    )r   num_embedding_devices_per_chipr!   s    r
   r#   z.HardwareFeature.num_embedding_devices_per_chipJ   s     **IIIr   N)r   r   r   r   r   enumEnumr   classmethodr   propertyr    r#   r   r   r
   r   r      s[    7A   O O ; ; J Jr   r   )r   r$   tensorflow.core.protobuf.tpur    tensorflow.python.util.tf_exportr   objectr   r   r   r
   <module>r+      s7    !  5 6 -.;Jf ;J /;Jr   