| View source on GitHub | 
Mapping from logical cores in a computation to the physical TPU topology.
tf.tpu.experimental.DeviceAssignment(
    topology: tf.tpu.experimental.Topology,
    core_assignment: np.ndarray
)
  Prefer to use the DeviceAssignment.build() helper to construct a DeviceAssignment; it is easier if less flexible than constructing a DeviceAssignment directly.
| Args | |
|---|---|
| topology | A Topologyobject that describes the physical TPU topology. | 
| core_assignment | A logical to physical core mapping, represented as a rank 3 numpy array. See the description of the core_assignmentproperty for more details. | 
| Raises | |
|---|---|
| ValueError | If topologyis notTopologyobject. | 
| ValueError | If core_assignmentis not a rank 3 numpy array. | 
| Attributes | |
|---|---|
| core_assignment | The logical to physical core mapping. | 
| num_cores_per_replica | The number of cores per replica. | 
| num_replicas | The number of replicas of the computation. | 
| topology | A Topologythat describes the TPU topology. | 
build
@staticmethod
build(
    topology: tf.tpu.experimental.Topology,
    computation_shape: Optional[np.ndarray] = None,
    computation_stride: Optional[np.ndarray] = None,
    num_replicas: int = 1
) -> 'DeviceAssignment'
 coordinates
coordinates(
    replica: int, logical_core: int
) -> Tuple
 Returns the physical topology coordinates of a logical core.
host_device
host_device(
    replica: int = 0, logical_core: int = 0, job: Optional[Text] = None
) -> Text
 Returns the CPU device attached to a logical core.
lookup_replicas
lookup_replicas(
    task_id: int, logical_core: int
) -> List[int]
 Lookup replica ids by task number and logical core.
| Args | |
|---|---|
| task_id | TensorFlow task number. | 
| logical_core | An integer, identifying a logical core. | 
| Returns | |
|---|---|
| A sorted list of the replicas that are attached to that task and logical_core. | 
| Raises | |
|---|---|
| ValueError | If no replica exists in the task which contains the logical core. | 
tpu_device
tpu_device(
    replica: int = 0, logical_core: int = 0, job: Optional[Text] = None
) -> Text
 Returns the name of the TPU device assigned to a logical core.
tpu_ordinal
tpu_ordinal(
    replica: int = 0, logical_core: int = 0
) -> int
 Returns the ordinal of the TPU device assigned to a logical core.
    © 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
    https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/tpu/experimental/DeviceAssignment