code: def np_value_to_feature(value):
      """Maps dataset values to tf Features.
      Only numpy types are supported since Datasets only contain tensors.
      Each datatype should only have one way of being serialized."""
      if isinstance(value, np.ndarray):
          # feature = _bytes_feature(value.tostring())
          if np.issubdtype(value.dtype, np.integer):
              feature = _int64_feature(value.flatten())
          elif np.issubdtype(value.dtype, np.float):
              feature = _float_feature(value.flatten())
          elif np.issubdtype(value.dtype, np.bool):
              feature = _int64_feature(value.flatten())
          else:
              raise TypeError(
                  f"value dtype: {value.dtype} is not recognized."
              )
      elif isinstance(value, bytes):
          feature = _bytes_feature([value])
      elif np.issubdtype(type(value), np.integer):
          feature = _int64_feature([value])
      elif np.issubdtype(type(value), np.float):
          feature = _float_feature([value])
  
      else:
          raise TypeError(
              f"value type: {type(value)} is not recognized. value must be a valid Numpy object."
          )
  
      return feature
  
file_path: io/tensorflow_io/python/experimental/serial_ops.py
imports: import functools
  import os
  import tempfile
  import numpy
  import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: np_value_to_feature(value) and returns: feature