code: def prepare_op_inputs(op, arg_params, int64_tensor):
      inputs = []
  
      # 4d tensor is needed by following ops
      ops_4d = ["depth_to_space", "space_to_depth", "pad"]
  
      # 3d tensor is needed by following ops
      ops_3d = {"CTCLoss", "ctc_loss"}
  
      # For ops with args that need to change shape/value for different ops
      custom_data = {
          "Activation",
          "LeakyReLU",
          "Softmax",
          "BilinearSampler",
          "GridGenerator",
          "sample_multinomial",
          "linalg_maketrian",
          "SpatialTransformer",
          "col2im",
          "GroupNorm",
          "Dropout",
          "FullyConnected",
          "BatchNorm",
          "L2Normalization",
          "LayerNorm",
          "InstanceNorm",
          "Embedding",
          "Correlation",
          "im2col",
          "LRN",
          "squeeze",
          "fill_element_0index",
      }
  
      custom_data_int64 = {
          "random_pdf_dirichlet",
          "random_pdf_exponential",
          "random_pdf_gamma",
          "random_pdf_generalized_negative_binomial",
          "random_pdf_negative_binomial",
          "random_pdf_normal",
          "random_pdf_poisson",
          "random_pdf_uniform",
          "sample_exponential",
          "sample_normal",
          "sample_poisson",
          "sample_uniform",
          "sample_gamma",
          "sample_generalized_negative_binomial",
          "sample_negative_binomial",
          "CTCLoss",
          "ctc_loss",
          "multi_lars",
      }
  
      int_only = {"random_randint"}
      float_only = {"log_softmax", "softmax", "softmin"}
  
      # following ops need atleast 1 dim of size 1
      ops_dim1 = [
          "broadcast_axis",
          "broadcast_like",
          "broadcast_to",
          "broadcast_axes",
      ]
  
      if int64_tensor == "on":
          default_inputs = DEFAULTS_INPUTS_LARGE_TENSOR
          custom_data |= custom_data_int64
      else:
          default_inputs = DEFAULTS_INPUTS
  
      # Prepare op to default input mapping
      arg_values = {}
      for arg_name, arg_type in zip(
          arg_params["params"]["arg_names"],
          arg_params["params"]["arg_types"],
      ):
          # Due to lack of an internal API for fetching permissible dtype
          # added a logic for using float only dtype as input for ops that take only floats
          # same for randint (which is the only op that takes only int as input)
          # rest all operators take int as well as float
          if "NDArray" in arg_type:
              if op in int_only and arg_name == "dtype":
                  arg_values[arg_name] = DEFAULTS_INPUTS["dtype_int"]
              elif (
                  op.startswith(("random", "sample"))
                  or op in float_only
              ) and arg_name == "dtype":
                  arg_values[arg_name] = DEFAULTS_INPUTS["dtype_float"]
              elif op == "ravel_multi_index":
                  arg_values[arg_name] = DEFAULTS_INPUTS["ravel_data"]
              elif (
                  op in custom_data
                  and arg_name + "_" + op.lower() in DEFAULTS_INPUTS
              ):
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_" + op.lower()
                  ]
              elif arg_name + "_nd" in DEFAULTS_INPUTS:
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_nd"
                  ]
              elif op in ops_3d and arg_name + "_3d" in DEFAULTS_INPUTS:
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_3d"
                  ]
              elif op == "softmax_cross_entropy":
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_smce"
                  ]
              elif op in ops_4d and arg_name + "_4d" in DEFAULTS_INPUTS:
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_4d"
                  ]
              elif (
                  op in ops_dim1
                  and arg_name + "_dim1" in DEFAULTS_INPUTS
              ):
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_dim1"
                  ]
              # default case
              elif arg_name in DEFAULTS_INPUTS:
                  arg_values[arg_name] = DEFAULTS_INPUTS[arg_name]
          else:
              # arg_type is not NDArray
              if op in int_only and arg_name == "dtype":
                  arg_values[arg_name] = DEFAULTS_INPUTS["dtype_int"]
              elif (
                  op.startswith(("random", "sample"))
                  or op in float_only
              ) and arg_name == "dtype":
                  arg_values[arg_name] = DEFAULTS_INPUTS["dtype_float"]
              elif (
                  op in custom_data
                  and arg_name + "_" + op.lower() in DEFAULTS_INPUTS
              ):
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_" + op.lower()
                  ]
              elif op in ops_4d and arg_name + "_4d" in DEFAULTS_INPUTS:
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_4d"
                  ]
              elif (
                  op in ops_dim1
                  and arg_name + "_dim1" in DEFAULTS_INPUTS
              ):
                  arg_values[arg_name] = DEFAULTS_INPUTS[
                      arg_name + "_dim1"
                  ]
              # default case
              elif arg_name in DEFAULTS_INPUTS:
                  arg_values[arg_name] = DEFAULTS_INPUTS[arg_name]
  
      # Number of different inputs we want to use to test
      # the operator
      num_input_combinations = max(
          [len(value) for value in arg_values.values()]
      )
  
      # Prepare key/value args for param to input value
      for idx in range(num_input_combinations):
          inp = {}
          for arg_name in arg_params["params"]["arg_names"]:
              if arg_name in arg_values:
                  if (
                      len(arg_values[arg_name])
                      == num_input_combinations
                  ):
                      inp[arg_name] = arg_values[arg_name][idx]
                  else:
                      # This is required when we want to use a param same across all
                      # input combination. Example: keeping low and high same for random sampling
                      # operator for all different types of Tensor shape.
                      inp[arg_name] = arg_values[arg_name][0]
  
          inputs.append(inp)
      return inputs
  
imports: from operator import itemgetter
  from mxnet import runtime
  import mxnet
  from benchmark.opperf.rules.default_params import DEFAULTS_INPUTS, DEFAULTS_INPUTS_LARGE_TENSOR, MX_OP_MODULE
label_desc: Use image node_id 5 for calling a global function with example usage: prepare_op_inputs(op, arg_params, int64_tensor) and returns: inputs