MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _invert_topology

Method _invert_topology

tensorflow/python/tpu/topology.py:128–137  ·  view source on GitHub ↗

Inverts a [task,device,axis] topology to [x,y,z] -> task/device maps.

(self)

Source from the content-addressed store, hash-verified

126 self._device_coordinates = coords
127
128 def _invert_topology(self):
129 """Inverts a [task,device,axis] topology to [x,y,z] -> task/device maps."""
130 tasks = np.full(list(self.mesh_shape), -1, dtype=np.int32)
131 devices = np.full(list(self.mesh_shape), -1, dtype=np.int32)
132 for task in xrange(self.device_coordinates.shape[0]):
133 for device in xrange(self.device_coordinates.shape[1]):
134 x, y, z = self.device_coordinates[task, device, :]
135 tasks[x, y, z] = task
136 devices[x, y, z] = device
137 return tasks, devices
138
139 @property
140 def mesh_shape(self):

Callers 1

__init__Method · 0.95

Calls 1

fullMethod · 0.80

Tested by

no test coverage detected