tensorflow / 2.9.1 / config / physicaldevice.html /

tf.config.PhysicalDevice

Abstraction for a locally visible physical device.

TensorFlow can utilize various devices such as the CPU or multiple GPUs for computation. Before initializing a local device for use, the user can customize certain properties of the device such as it's visibility or memory configuration.

Once a visible tf.config.PhysicalDevice is initialized one or more tf.config.LogicalDevice objects are created. Use tf.config.set_visible_devices to configure the visibility of a physical device and tf.config.set_logical_device_configuration to configure multiple tf.config.LogicalDevice objects for a tf.config.PhysicalDevice. This is useful when separation between models is needed or to simulate a multi-device environment.

Fields:

  • name: Unique identifier for device.
  • device_type: String declaring the type of device such as "CPU" or "GPU".
Attributes
name A namedtuple alias for field number 0
device_type A namedtuple alias for field number 1

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/config/PhysicalDevice