Create a new `DeviceSpec` object. Args: job: string. Optional job name. replica: int. Optional replica index. task: int. Optional task index. device_type: Optional device type string (e.g. "CPU" or "GPU") device_index: int. Optional device index. If left
(self, job=None, replica=None, task=None, device_type=None,
device_index=None)
| 90 | "_as_string", "_hash") |
| 91 | |
| 92 | def __init__(self, job=None, replica=None, task=None, device_type=None, |
| 93 | device_index=None): |
| 94 | """Create a new `DeviceSpec` object. |
| 95 | |
| 96 | Args: |
| 97 | job: string. Optional job name. |
| 98 | replica: int. Optional replica index. |
| 99 | task: int. Optional task index. |
| 100 | device_type: Optional device type string (e.g. "CPU" or "GPU") |
| 101 | device_index: int. Optional device index. If left |
| 102 | unspecified, device represents 'any' device_index. |
| 103 | """ |
| 104 | self._job = _as_str_or_none(job) |
| 105 | self._replica = _as_int_or_none(replica) |
| 106 | self._task = _as_int_or_none(task) |
| 107 | self._device_type = _as_device_str_or_none(device_type) |
| 108 | self._device_index = _as_int_or_none(device_index) |
| 109 | self._as_string = self._components_to_string( |
| 110 | job=self._job, replica=self._replica, task=self._task, |
| 111 | device_type=self._device_type, device_index=self._device_index) |
| 112 | self._hash = hash(self.to_string()) |
| 113 | |
| 114 | def to_string(self): |
| 115 | """Return a string representation of this `DeviceSpec`. |
nothing calls this directly
no test coverage detected