code: def get_mx_np_ndarray(
      ctx, in_tensor, dtype, initializer, attach_grad=True
  ):
      """Helper function to prepare a MXNet Numpy NDArray tensor in given Context (ctx) of type (dtype).
      You can get a new Tensor by providing only "Shape" or "Numpy NDArray" or another MXNet NDArray as
      "in_tensor".
  
      NOTE: This is a sync call and waits for the Tensor to be created.
  
      Parameters
      ----------
      ctx: mx.ctx, default mx.cpu()
          Context of the new MXNet NDArray Tensor.
      in_tensor: Numpy NDArray or MXNet NDArray or Tuple of shape
          Can be a tuple of shape or Numpy NDArray or MXNet NDArray.
      dtype: str
          Precision or Dtype of the expected Tensor. Ex: "float32", "Int64"
      initializer:
          Function reference to the initialize to use. Ex: mx.nd.random.normal, mx.nd.zeros
      attach_grad: Boolean, default True
          To attach a gradient for the Tensor. Default is True.
  
      Returns
      -------
      MXNet NDArray Tensor.
      """
      if isinstance(in_tensor, int) or isinstance(in_tensor, float):
          return in_tensor
  
      if isinstance(in_tensor, tuple):
          nd_ndarray = get_mx_ndarray(
              ctx=ctx,
              in_tensor=in_tensor,
              dtype="float32",
              initializer=initializer,
              attach_grad=attach_grad,
          )
          tensor = nd_ndarray.as_np_ndarray().astype(dtype=dtype)
      elif isinstance(in_tensor, list):
          tensor = np.array(in_tensor, ctx=ctx)
      elif isinstance(in_tensor, nd.NDArray):
          tensor = in_tensor.as_np_ndarray()
      elif isinstance(in_tensor, np.ndarray):
          tensor = in_tensor.as_in_context(ctx)
      else:
          raise ValueError(
              "Invalid input type for creating input tensor. Input can be tuple() of shape or Numpy Array or"
              " MXNet NDArray. Given - ",
              in_tensor,
          )
      if attach_grad:
          tensor.attach_grad()
  
      tensor.wait_to_read()
      return tensor
  
file_path: mxnet/benchmark/opperf/utils/benchmark_utils.py
imports: import logging
  import inspect
  import mxnet
  from mxnet import nd
  from mxnet import np
  from .ndarray_utils import get_mx_ndarray, nd_forward_and_profile, nd_forward_backward_and_profile
  from .common_utils import merge_map_list
  from .op_registry_utils import prepare_op_inputs
  from benchmark.opperf.rules.default_params import PARAMS_OF_TYPE_NDARRAY, PARAMS_OF_TYPE_NP_ARRAY
  from .profiler_utils import cpp_profile, python_profile
label_desc: Use image node_id 2 for calling a global function with example usage: get_mx_np_ndarray(ctx, in_tensor, dtype, initializer, attach_grad) and returns: tensor, in_tensor