def METHOD_NAME(data):
    r"""Converts each NumPy array data field into a tensor"""
    elem_type = type(data)
    if isinstance(data, (flow.Tensor, flow._oneflow_internal.Tensor)):
        return data
    elif (
        elem_type.__module__ == "numpy"
        and elem_type.__name__ != "str_"
        and elem_type.__name__ != "string_"
    ):
        # array of string classes and object
        if (
            elem_type.__name__ == "ndarray"
            and np_str_obj_array_pattern.search(data.dtype.str) is not None
        ):
            return data
        return flow.tensor(data)
    elif isinstance(data, collections.abc.Mapping):
        return {key: METHOD_NAME(data[key]) for key in data}
    elif isinstance(data, tuple) and hasattr(data, "_fields"):  # namedtuple
        return elem_type(*(METHOD_NAME(d) for d in data))
    elif isinstance(data, collections.abc.Sequence) and not isinstance(
        data, string_classes
    ):
        return [METHOD_NAME(d) for d in data]
    else:
        # NOTE: pytorch just return data here, and not raise any exception!
        raise TypeError(default_convert_err_msg_format.format(elem_type))