Struct-like object describing a device's attributes. Each device has 3 key properties: - name: the fully-qualified TensorFlow path to the device. For example: /job:worker/replica:0/task:3/device:CPU:0 - device_type: the type of the device (e.g. CPU, GPU, TPU, etc.) - memory_limit
| 586 | |
| 587 | |
| 588 | class _DeviceAttributes(object): |
| 589 | """Struct-like object describing a device's attributes. |
| 590 | |
| 591 | Each device has 3 key properties: |
| 592 | - name: the fully-qualified TensorFlow path to the device. For |
| 593 | example: /job:worker/replica:0/task:3/device:CPU:0 |
| 594 | - device_type: the type of the device (e.g. CPU, GPU, TPU, etc.) |
| 595 | - memory_limit_bytes: the maximum amount of memory available on the device |
| 596 | (in bytes). |
| 597 | """ |
| 598 | |
| 599 | def __init__(self, name, device_type, memory_limit_bytes, incarnation): |
| 600 | self._name = device.canonical_name(name) |
| 601 | self._device_type = device_type |
| 602 | self._memory_limit_bytes = memory_limit_bytes |
| 603 | self._incarnation = incarnation |
| 604 | |
| 605 | @property |
| 606 | def name(self): |
| 607 | return self._name |
| 608 | |
| 609 | @property |
| 610 | def device_type(self): |
| 611 | return self._device_type |
| 612 | |
| 613 | @property |
| 614 | def memory_limit_bytes(self): |
| 615 | return self._memory_limit_bytes |
| 616 | |
| 617 | @property |
| 618 | def incarnation(self): |
| 619 | return self._incarnation |
| 620 | |
| 621 | def __repr__(self): |
| 622 | return '_DeviceAttributes(%s, %s, %d, %d)' % ( |
| 623 | self.name, |
| 624 | self.device_type, |
| 625 | self.memory_limit_bytes, |
| 626 | self.incarnation, |
| 627 | ) |
| 628 | |
| 629 | |
| 630 | class BaseSession(SessionInterface): |