code: def test_gpu_memory_profiler_gluon():
      enable_profiler(profile_filename="test_profiler.json")
      profiler.set_state("run")
  
      model = nn.HybridSequential()
      model.add(nn.Dense(128, activation="tanh"))
      model.add(nn.Dropout(0.5))
      model.add(
          nn.Dense(64, activation="tanh"), nn.Dense(32, in_units=64)
      )
      model.add(nn.Activation("relu"))
      model.initialize(device=mx.gpu())
      model.hybridize()
  
      with mx.autograd.record():
          out = model(mx.np.zeros((16, 10), device=mx.gpu()))
      out.backward()
      mx.npx.waitall()
      profiler.set_state("stop")
      profiler.dump(True)
  
      # Sample gpu_memory_profile.csv:
      # "Attribute Name","Requested Size","Device","Actual Size","Reuse?"
      # <unk>:in_arg:data,640,0,4096,0
      # hybridsequential:activation0:hybridsequential_activation0_fwd,2048,0,4096,0
      # hybridsequential:activation0:hybridsequential_activation0_fwd_backward,8192,0,8192,0
      # hybridsequential:activation0:hybridsequential_activation0_fwd_head_grad,2048,0,4096,0
      # hybridsequential:dense0:activation0:hybridsequential_dense0_activation0_fwd,8192,0,8192,0
      # hybridsequential:dense0:arg_grad:bias,512,0,4096,0
      # hybridsequential:dense0:arg_grad:weight,5120,0,8192,0
      # hybridsequential:dense0:hybridsequential_dense0_fwd,8192,0,8192,0
      # hybridsequential:dense0:in_arg:bias,512,0,4096,0
      # hybridsequential:dense0:in_arg:weight,5120,0,8192,0
      # hybridsequential:dense1:activation0:hybridsequential_dense1_activation0_fwd,4096,0,4096,0
      # hybridsequential:dense1:arg_grad:bias,256,0,4096,0
      # hybridsequential:dense1:arg_grad:weight,32768,0,32768,0
      # hybridsequential:dense1:hybridsequential_dense1_fwd,4096,0,4096,0
      # hybridsequential:dense1:in_arg:bias,256,0,4096,0
      # hybridsequential:dense1:in_arg:weight,32768,0,32768,0
      # hybridsequential:dense2:arg_grad:bias,128,0,4096,0
      # hybridsequential:dense2:arg_grad:weight,8192,0,8192,0
      # hybridsequential:dense2:hybridsequential_dense2_fwd_backward,4096,0,4096,1
      # hybridsequential:dense2:in_arg:bias,128,0,4096,0
      # hybridsequential:dense2:in_arg:weight,8192,0,8192,0
      # hybridsequential:dropout0:hybridsequential_dropout0_fwd,8192,0,8192,0
      # hybridsequential:dropout0:hybridsequential_dropout0_fwd,8192,0,8192,0
      # resource:cudnn_dropout_state (dropout-inl.h +256),1474560,0,1474560,0
      # resource:temp_space (fully_connected-inl.h +316),15360,0,16384,0
  
      # We are only checking for weight parameters here, also making sure that
      # there is no unknown entries in the memory profile.
      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 param in model.collect_params().values():
              expected_arg_name = (
                  f"{param.var().attr('__profiler_scope__')}in_arg:"
                  + param.name
              )
              expected_arg_size = str(4 * np.prod(param.shape))
              csv_file.seek(0)
              entry_found = False
              for row in csv_reader:
                  if (
                      row["Attribute Name"] == expected_arg_name
                      and row["Requested Size"] == expected_arg_size
                  ):
                      entry_found = True
                      break
              assert (
                  entry_found
              ), "Entry for (attr_name={}, alloc_size={}) has not been found".format(
                  expected_arg_name, expected_arg_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 2 for calling a global function with example usage: test_gpu_memory_profiler_gluon() without return types