code: def test_gpu_memory_profiler_symbolic():
      enable_profiler("test_profiler.json")
      profiler.set_state("run")
  
      with profiler.scope("tensordot"):
          A = mx.sym.Variable("A")
          B = mx.sym.Variable("B")
          C = mx.symbol.dot(A, B, name="dot")
  
      executor = C._simple_bind(
          mx.gpu(), "write", A=(1024, 2048), B=(2048, 4096)
      )
  
      with profiler.scope("init"):
          a = mx.random.uniform(-1.0, 1.0, shape=(1024, 2048))
          b = mx.random.uniform(-1.0, 1.0, shape=(2048, 4096))
  
      a.copyto(executor.arg_dict["A"])
      b.copyto(executor.arg_dict["B"])
  
      executor.forward()
      executor.backward()
      c = executor.outputs[0]
      mx.nd.waitall()
      profiler.set_state("stop")
      profiler.dump(True)
  
      expected_alloc_entries = [
          {
              "Attribute Name": "tensordot:in_arg:A",
              "Requested Size": str(4 * a.size),
          },
          {
              "Attribute Name": "tensordot:in_arg:B",
              "Requested Size": str(4 * b.size),
          },
          {
              "Attribute Name": "tensordot:dot",
              "Requested Size": str(4 * c.size),
          },
          {
              "Attribute Name": "tensordot:dot_backward",
              "Requested Size": str(4 * a.size),
          },
          {
              "Attribute Name": "tensordot:dot_backward",
              "Requested Size": str(4 * b.size),
          },
          {
              "Attribute Name": "init:_random_uniform",
              "Requested Size": str(4 * a.size),
          },
          {
              "Attribute Name": "init:_random_uniform",
              "Requested Size": str(4 * b.size),
          },
      ]
  
      # Sample gpu_memory_profile.csv:
      # "Attribute Name","Requested Size","Device","Actual Size","Reuse?"
      # <unk>:_head_grad_0,16777216,0,16777216,0
      # init:_random_uniform,33554432,0,33554432,1
      # init:_random_uniform,8388608,0,8388608,1
      # resource:temp_space (sample_op.h +365),8,0,4096,0
      # symbol:arg_grad:unknown,8388608,0,8388608,0
      # symbol:arg_grad:unknown,33554432,0,33554432,0
      # tensordot:dot,16777216,0,16777216,0
      # tensordot:dot_backward,8388608,0,8388608,0
      # tensordot:dot_backward,33554432,0,33554432,0
      # tensordot:in_arg:A,8388608,0,8388608,0
      # tensordot:in_arg:B,33554432,0,33554432,0
  
      with open(
          f"gpu_memory_profile-pid_{os.getpid()}.csv", mode="r"
      ) as csv_file:
          csv_reader = csv.DictReader(csv_file)
          for row in csv_reader:
              print(",".join(list(row.values())))
          for expected_alloc_entry in expected_alloc_entries:
              csv_file.seek(0)
              entry_found = False
              for row in csv_reader:
                  if (
                      row["Attribute Name"]
                      == expected_alloc_entry["Attribute Name"]
                      and row["Requested Size"]
                      == expected_alloc_entry["Requested Size"]
                  ):
                      entry_found = True
                      break
              assert (
                  entry_found
              ), "Entry for (attr_name={}, alloc_size={}) has not been found".format(
                  expected_alloc_entry["Attribute Name"],
                  expected_alloc_entry["Requested Size"],
              )
          # Make sure that there is no unknown allocation entry.
          csv_file.seek(0)
          for row in csv_reader:
              if (
                  row["Attribute Name"] == "<unk>:unknown"
                  or row["Attribute Name"] == "<unk>:"
              ):
                  assert (
                      False
                  ), "Unknown allocation entry has been encountered"
  
imports: import csv
  import os
  import sys
  import numpy
  import mxnet
  from test_profiler import *
label_desc: Use image node_id 1 for calling a global function with example usage: test_gpu_memory_profiler_symbolic() without return types