code: def make_np(x):
      if isinstance(x, list):
          return check_nan(np.array(x))
      if isinstance(x, np.ndarray):
          return check_nan(x)
      if isinstance(
          x, str
      ):  # Caffe2 will pass name of blob(s) to fetch
          return check_nan(prepare_caffe2(x))
      if np.isscalar(x):
          return check_nan(np.array([x]))
      if "torch" in str(type(x)):
          return check_nan(prepare_pytorch(x))
      if "chainer" in str(type(x)):
          return check_nan(prepare_chainer(x))
      if "mxnet" in str(type(x)):
          return check_nan(prepare_mxnet(x))
      if "jax" in str(type(x)):
          return check_nan(np.array(x))
      raise NotImplementedError(
          "Got {}, but expected numpy array or torch tensor.".format(
              type(x)
          )
      )
  
file_path: tensorboardX/examples/tensorboardX/x2num.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: make_np(x) and returns: check_nan, check_nan, check_nan, check_nan, check_nan, check_nan, check_nan, check_nan