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 __call__(self, node_def):
      # In general a user may create a device function which takes into account
      # arbitrary properties of an op. (For instance dynamically placing ops based
      # on type.) So even though the standard DeviceSpec route only uses the
      # device attribute, we take an entire node_def to maintain a consistent
      # signature with general device functions.
      current_device = DeviceSpec.from_string(node_def.device or "")
      return self._spec.make_merged_spec(current_device)
  
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 2 for calling the MergeDevice obj's underlying member method code with example usage: obj.__call__(node_def) and returns: self