code: def testPackedVarAndDevice(self):
      device0 = device_util.canonicalize("/cpu:0")
      device1 = device_util.canonicalize("/cpu:1")
  
      with ops.device(device0):
          v0 = resource_variable_ops.ResourceVariable(1.0)
      with ops.device(device1):
          v1 = resource_variable_ops.ResourceVariable(2.0)
  
      packed_var = (
          packed_distributed_variable.PackedDistributedVariable(
              [v0, v1]
          )
      )
  
      packed_var0 = packed_distributed_variable.PackedVarAndDevice(
          packed_var, device0
      )
      self.assertFalse(packed_var0.handle.is_packed)
      self.assertAllEqual(math_ops.mul(packed_var0, 2.0), 2.0)
  
      packed_var1 = packed_distributed_variable.PackedVarAndDevice(
          packed_var, device1
      )
      self.assertAllEqual(packed_var1.assign(3.0), 3.0)
  
      @def_function.function
      def func():
          self.assertTrue(packed_var.handle.is_packed)
          var0 = packed_distributed_variable.PackedVarAndDevice(
              packed_var, device0
          )
          var0.assign_add(3.0)
          var1 = packed_distributed_variable.PackedVarAndDevice(
              packed_var, device1
          )
          return var0.value(), math_ops.add(var1, 2.0)
  
      self.assertAllEqual(func(), (4.0, 5.0))
  
file_path: tensorflow/tensorflow/python/distribute/packed_distributed_variable_test.py
imports: from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import packed_distributed_variable
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 3 for calling the PackedDistributedVariableTest obj's underlying member method code with example usage: obj.testPackedVarAndDevice() and returns: var0,  math_ops