code: def np_to_arma(obj):
      """
      This function replaces a numpy array to json representation
      of armadillo vector. This is reverse of "arma_to_np(obj)".
      """
      if isinstance(obj, OrderedDict):
          for key in obj.keys():
              """
              Checking if this is a numpy array.
              """
              if isinstance(obj[key], np.ndarray):
                  # n_rows, n_cols have to be strings.
                  n_rows, n_cols = obj[key].shape
  
                  dic = OrderedDict()
  
                  dic["n_rows"] = str(n_cols)  # implicit transpose
                  dic["n_cols"] = str(n_rows)  # implicit transpose
  
                  if n_cols != 1 and n_rows != 1:
                      dic["vec_state"] = "0"
                  elif n_rows == 1:
                      dic["vec_state"] = "1"
                  elif n_cols == 1:
                      dic["vec_state"] = "2"
  
                  elems = obj[key].flatten()
                  dic["elem"] = list(elems)
                  obj[key] = dic
              else:
                  np_to_arma(obj[key])
      elif isinstance(obj, list):
          for i in range(len(obj)):
              np_to_arma(obj[i])
      else:
          # we cannot recurse further if we do not have a
          # dictionary or list object, so just pass.
          pass
  
file_path: mlpack/src/mlpack/bindings/python/mlpack/preprocess_json_params.py
imports: import numpy
  import json
  import pprint
  from copy import deepcopy
  from collections import OrderedDict
label_desc: Use image node_id 3 for calling a global function with example usage: np_to_arma(obj) without return types