def sequence_to_td64ns(data, copy=False, unit="<STR_LIT>", errors="<STR_LIT>"):
inferred_freq = None<EOL>unit = parse_timedelta_unit(unit)<EOL>if not hasattr(data, '<STR_LIT>'):<EOL><INDENT>if np.ndim(data) == <NUM_LIT:0>:<EOL><INDENT>data = list(data)<EOL><DEDENT>data = np.array(data, copy=False)<EOL><DEDENT>elif isinstance(data, ABCSeries):<EOL><INDENT>data = data._values<EOL><DEDENT>elif isinstance(data, (ABCTimedeltaIndex, TimedeltaArray)):<EOL><INDENT>inferred_freq = data.freq<EOL>data = data._data<EOL><DEDENT>if is_object_dtype(data.dtype) or is_string_dtype(data.dtype):<EOL><INDENT>data = objects_to_td64ns(data, unit=unit, errors=errors)<EOL>copy = False<EOL><DEDENT>elif is_integer_dtype(data.dtype):<EOL><INDENT>data, copy_made = ints_to_td64ns(data, unit=unit)<EOL>copy = copy and not copy_made<EOL><DEDENT>elif is_float_dtype(data.dtype):<EOL><INDENT>mask = np.isnan(data)<EOL>m, p = precision_from_unit(unit)<EOL>base = data.astype(np.int64)<EOL>frac = data - base<EOL>if p:<EOL><INDENT>frac = np.round(frac, p)<EOL><DEDENT>data = (base * m + (frac * m).astype(np.int64)).view('<STR_LIT>')<EOL>data[mask] = iNaT<EOL>copy = False<EOL><DEDENT>elif is_timedelta64_dtype(data.dtype):<EOL><INDENT>if data.dtype != _TD_DTYPE:<EOL><INDENT>data = data.astype(_TD_DTYPE)<EOL>copy = False<EOL><DEDENT><DEDENT>elif is_datetime64_dtype(data):<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT:version>",<EOL>FutureWarning, stacklevel=<NUM_LIT:4>)<EOL>data = ensure_int64(data).view(_TD_DTYPE)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>.format(dtype=data.dtype))<EOL><DEDENT>data = np.array(data, copy=copy)<EOL>if data.ndim != <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>assert data.dtype == '<STR_LIT>', data<EOL>return data, inferred_freq<EOL>
Parameters
----------
array : list-like
copy : bool, default False
unit : str, default "ns"
    The timedelta unit to treat integers as multiples of.
errors : {"raise", "coerce", "ignore"}, default "raise"
    How to handle elements that cannot be converted to timedelta64[ns].
    See ``pandas.to_timedelta`` for details.

Returns
-------
converted : numpy.ndarray
    The sequence converted to a numpy array with dtype ``timedelta64[ns]``.
inferred_freq : Tick or None
    The inferred frequency of the sequence.

Raises
------
ValueError : Data cannot be converted to timedelta64[ns].

Notes
-----
Unlike `pandas.to_timedelta`, if setting ``errors=ignore`` will not cause
errors to be ignored; they are caught and subsequently ignored at a
higher level.