code: def testNestedDeviceFunctions(self):
      with ops.Graph().as_default():
          var_0 = variable_v1.VariableV1(0)
          with ops.device(TestDeviceFuncPinVariableToCpu):
              var_1 = variable_v1.VariableV1(1)
              with ops.device(lambda op: "/device:GPU:0"):
                  var_2 = variable_v1.VariableV1(2)
              with ops.device(
                  "/device:GPU:0"
              ):  # Implicit merging device function.
                  var_3 = variable_v1.VariableV1(3)
  
      self.assertDeviceEqual(var_0.device, None)
      self.assertDeviceEqual(var_1.device, "/device:CPU:0")
      self.assertDeviceEqual(var_2.device, "/device:GPU:0")
      self.assertDeviceEqual(var_3.device, "/device:GPU:0")
  
imports: from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.framework import function_pb2
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.framework import node_def_pb2
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import function
  from tensorflow.python.framework import graph_util
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import gen_state_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.platform import test
  from tensorflow.python.util import compat
label_desc: Use image node_id 2 for calling the GraphUtilTest obj's underlying member method code with example usage: obj.testNestedDeviceFunctions() without return types