Inverts a [task,device,axis] topology to [x,y,z] -> task/device maps.
(self)
| 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): |