tf.config.experimental.get_virtual_device_configuration

TensorFlow 1 version View source on GitHub

Get the virtual device configuration for a PhysicalDevice.

tf.config.experimental.get_virtual_device_configuration(device)

Returns the list of VirtualDeviceConfiguration objects previously configured by a call to tf.config.experimental.set_virtual_device_configuration().

For example:

physical_devices = tf.config.experimental.list_physical_devices('CPU')
assert len(physical_devices) == 1, "No CPUs found"
configs = tf.config.experimental.get_virtual_device_configuration(
    physical_devices[0])
assert configs is None
tf.config.experimental.set_virtual_device_configuration(
    physical_devices[0],
    [tf.config.experimental.VirtualDeviceConfiguration(),
     tf.config.experimental.VirtualDeviceConfiguration()])
configs = tf.config.experimental.get_virtual_device_configuration(
    physical_devices[0])
assert len(configs) == 2

Args:

  • device: PhysicalDevice to query

Returns:

List of tf.config.experimental.VirtualDeviceConfiguration objects or None if no virtual device configuration has been set for this physical device.

Compat aliases