Return a string (not canonicalized) for the current device.
()
| 91 | |
| 92 | |
| 93 | def current(): |
| 94 | """Return a string (not canonicalized) for the current device.""" |
| 95 | # TODO(josh11b): Work out how this function interacts with ops.colocate_with. |
| 96 | if ops.executing_eagerly_outside_functions(): |
| 97 | d = context.context().device_name |
| 98 | else: |
| 99 | op = _FakeOperation() |
| 100 | ops.get_default_graph()._apply_device_functions(op) # pylint: disable=protected-access |
| 101 | d = op.device |
| 102 | return d |
| 103 | |
| 104 | |
| 105 | def get_host_for_device(device): |
no test coverage detected