class_docstr: A device which executes operations in parallel.
class_docstr_tok: ["A","device","which","executes","operations","in","parallel","."]
docstr: Creates a device which executes operations in parallel on `components`.
  
  Args:
    components: A list of device names. Each operation executed on the
      returned device executes on these component devices.
  
  Returns:
    A string with the name of the newly created device.
docstr_tok: ["Creates","a","device","which","executes","operations","in","parallel","on","`","components","`",".","Args",":","components",":","A","list","of","device","names",".","Each","operation","executed","on","the","returned","device","executes","on","these","component","devices",".","Returns",":","A","string","with","the","name","of","the","newly","created","device","."]
code: def __init__(self, components):
      """Creates a device which executes operations in parallel on `components`.
  
      Args:
        components: A list of device names. Each operation executed on the
          returned device executes on these component devices.
  
      Returns:
        A string with the name of the newly created device.
      """
      global _next_device_number, _next_device_number_lock
      self.components = tuple(
          device_util.canonicalize(d) for d in components
      )
      if not self.components:
          raise ValueError(
              "ParallelDevice requires at least one component."
          )
      ctx = context.context()
      with _next_device_number_lock:
          # TODO(allenl): Better names for parallel devices (right now "CUSTOM" is
          # special-cased).
          self._name = "{}/device:CUSTOM:{}".format(
              ctx.host_address_space(), _next_device_number
          )
          _next_device_number += 1
      (
          device,
          device_info,
      ) = _pywrap_parallel_device.GetParallelDeviceCapsules(
          self._name, self.components
      )
      context.register_custom_device(device, self._name, device_info)
      self._device_ids = None
      self._device_scope = None
      _all_parallel_devices[self._name] = self
  
imports: import threading
  import weakref
  from tensorflow.python import _pywrap_parallel_device
  from tensorflow.python.distribute import device_util
  from tensorflow.python.eager import context
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.tpu.ops import tpu_ops
  from tensorflow.python.util import nest
  from tensorflow.python.util import variable_utils
label_desc: Use image node_id 1 to create a new ParallelDevice object from inherited base classes: object with example: obj = ParallelDevice(components)