code: def testDeviceDetails(self):
      (cpu,) = config.list_physical_devices("CPU")
      details = config.get_device_details(cpu)
      self.assertEqual(details, {})
  
      if not test_util.is_gpu_available():
          return
  
      gpus = config.list_physical_devices("GPU")
      details = config.get_device_details(gpus[0])
      self.assertIsInstance(details["device_name"], str)
      self.assertNotEmpty(details["device_name"])
      if test.is_built_with_rocm():
          # AMD GPUs do not have a compute capability
          self.assertNotIn("compute_capability", details)
      else:
          cc = details["compute_capability"]
          self.assertIsInstance(cc, tuple)
          major, minor = cc
          self.assertGreater(major, 0)
          self.assertGreaterEqual(minor, 0)
  
      # Test GPU returned from get_visible_devices
      if len(gpus) > 2:
          config.set_visible_devices(gpus[1], "GPU")
          (visible_gpu,) = config.get_visible_devices("GPU")
          details = config.get_device_details(visible_gpu)
          self.assertIsInstance(details["device_name"], str)
  
imports: from absl.testing import parameterized
  from tensorflow.core.protobuf import cluster_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.core.protobuf import tensorflow_server_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import test
  from tensorflow.python.util import compat
label_desc: Use image node_id 5 for calling the DeviceTest obj's underlying member method code with example usage: obj.testDeviceDetails() without return types