code: def run_benchmark(cell_type, ctx, seq_len, batch_size, hidden_dim):
      obj = {"foreach": ForeachRNN, "while_loop": WhileRNN}[
          args.benchmark
      ]
      inputs = _array((seq_len, batch_size, hidden_dim), ctx)
      states = [
          _array((batch_size, hidden_dim), ctx)
          for _ in cell_type(0).state_info()
      ]
      if args.benchmark == "while_loop":
          states.insert(0, _zeros((1,), ctx))
  
      for is_train, is_hyb_cell, is_hyb_layer in product(
          [True, False], [False, True], [False, True]
      ):
          cell = cell_type(hidden_dim)
          cell.infer_shape(0, inputs, False)
          if is_hyb_cell:
              cell.hybridize(static_alloc=True)
          layer = obj(cell, seq_len)
          layer.initialize(ctx=ctx)
          if is_hyb_layer:
              layer.hybridize(static_alloc=True)
          print(
              f"is_train = {repr(is_train)}, hybridize_cell = {repr(is_hyb_cell)}, hybridize_layer = {repr(is_hyb_layer)}"
          )
          times = []
          for _ in range(args.warmup_rounds + args.test_rounds):
              tick = time()
              if not is_train:
                  res = layer(inputs, states)
              else:
                  with mx.autograd.record():
                      res = layer(inputs, states)
              if is_train:
                  res.backward()
              mx.npx.waitall()
              tock = time()
              times.append((tock - tick) * 1000.0)
          times = times[args.warmup_rounds :]
          print(
              f"Time used: mean = {onp.mean(times):.3f} ms, std = {onp.std(times):.3f} ms"
          )
  
imports: from __future__ import print_function
  from six.moves import range
  import argparse
  import subprocess
  from itertools import product
  from time import time
  import mxnet
  import numpy
  from mxnet import gluon, np, npx
label_desc: Use image node_id 4 for calling a global function with example usage: run_benchmark(cell_type, ctx, seq_len, batch_size, hidden_dim) without return types