code: def testPeakMemoryUsage(self, device_type):
      device = f"{device_type}:0"
      with ops.device(device):
          x1 = array_ops.zeros((1000, 1000))
      peak1 = config.get_memory_info(device)["peak"]
      self.assertGreaterEqual(peak1, 4 * 1000 * 1000)
      with ops.device(device):
          x2 = array_ops.ones((1000, 1000))
      peak2 = config.get_memory_info(device)["peak"]
      self.assertGreaterEqual(peak2, peak1 + 4 * 1000 * 1000)
      del (
          x1,
          x2,
      )  # With CPython, causes tensor memory to be immediately freed
      peak3 = config.get_memory_info(device)["peak"]
      self.assertGreaterEqual(peak3, peak2)
      self.assertGreaterEqual(
          peak3, config.get_memory_info(device)["current"]
      )
  
imports: from absl.testing import parameterized
  from tensorflow.core.protobuf import cluster_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.core.protobuf import tensorflow_server_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import test
  from tensorflow.python.util import compat
label_desc: Use image node_id 14 for calling the DeviceTest obj's underlying member method code with example usage: obj.testPeakMemoryUsage(device_type) without return types