DeviceAssignment
Defined in tensorflow/contrib/tpu/python/tpu/device_assignment.py.
Mapping from logical cores in a computation to the physical TPU topology.
Prefer to use the device_assignment() helper to construct a DeviceAssignment; it is easier if less flexible than constructing a DeviceAssignment directly.
computation_shapeThe computation shape.
A rank-1 int32 numpy array with size equal to the TPU topology rank. Describes the logical shape in numbers of core of each replica of the computation in the TPU topology.
The computation shape.
core_assignmentThe logical to physical core mapping.
A numpy array of rank topology_rank + 2, with shape [num_replicas] + computation_shape + [topology_rank]. Maps (replica, logical core coordinates) pairs to physical topology coordinates.
num_cores_per_replicaThe number of cores per replica.
num_replicasThe number of replicas of the computation.
topologyA Topology that describes the TPU topology.
__init____init__(
topology,
core_assignment
)
Constructs a DeviceAssignment object.
topology: A Topology object 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_assignment property for more details.ValueError: If topology is not Topology object.ValueError: If core_assignment is not a rank 3 numpy array.host_devicehost_device(
replica=0,
logical_core=None,
job=None
)
Returns the CPU device attached to a logical core.
lookup_replicaslookup_replicas(
task_id,
logical_core
)
Lookup replica ids by task number and logical core.
task_id: TensorFlow task number.logical_core: A tuple of three integers which represents a logical core.A sorted list of the replicas that are attached to that task and logical_core.
ValueError: If no replica exists in the task which contains the logical core.tpu_devicetpu_device(
replica=0,
logical_core=None,
job=None
)
Returns the name of the TPU device assigned to a logical core.
tpu_ordinaltpu_ordinal(
replica=0,
logical_core=None
)
Returns the ordinal of the TPU device assigned to a logical core.
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/tpu/DeviceAssignment