class_docstr: Wraps a device specification (DeviceSpec or str) with merge functionality.
  
  When called, this class will merge a node_def with its own spec. It also
  exposes a `shortcut_string_merge` method which can significantly improve
  performance of device placement.
class_docstr_tok: ["Wraps","a","device","specification","(","DeviceSpec","or","str",")","with","merge","functionality",".","When","called",",","this","class","will","merge","a","node_def","with","its","own","spec",".","It","also","exposes","a","`","shortcut_string_merge","`","method","which","can","significantly","improve","performance","of","device","placement","."]
code: def __init__(self, spec):
      if isinstance(spec, device_spec.DeviceSpecV2):
          self._spec = spec
      elif isinstance(spec, device_spec.DeviceSpecV1):
          # Capture a snapshot of spec.
          self._spec = spec.__class__.from_string(spec.to_string())
      else:
          self._spec = DeviceSpec.from_string(spec)
  
file_path: tensorflow/tensorflow/python/framework/device.py
imports: from tensorflow.python import tf2
  from tensorflow.python.framework import device_spec
label_desc: Use image node_id 1 to create a new MergeDevice object from inherited base classes: object with example: obj = MergeDevice(spec)