def sequence_to_dt64ns(data, dtype=None, copy=False,<EOL>tz=None,<EOL>dayfirst=False, yearfirst=False, ambiguous='<STR_LIT>',<EOL>int_as_wall_time=False):
inferred_freq = None<EOL>dtype = _validate_dt64_dtype(dtype)<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.asarray(data)<EOL>copy = False<EOL><DEDENT>elif isinstance(data, ABCSeries):<EOL><INDENT>data = data._values<EOL><DEDENT>if isinstance(data, ABCPandasArray):<EOL><INDENT>data = data.to_numpy()<EOL><DEDENT>if hasattr(data, "<STR_LIT>"):<EOL><INDENT>inferred_freq = data.freq<EOL><DEDENT>tz = validate_tz_from_dtype(dtype, tz)<EOL>if isinstance(data, ABCIndexClass):<EOL><INDENT>data = data._data<EOL><DEDENT>data, copy = maybe_convert_dtype(data, copy)<EOL>if is_object_dtype(data) or is_string_dtype(data):<EOL><INDENT>copy = False<EOL>if lib.infer_dtype(data, skipna=False) == '<STR_LIT>':<EOL><INDENT>data = data.astype(np.int64)<EOL><DEDENT>else:<EOL><INDENT>data, inferred_tz = objects_to_datetime64ns(<EOL>data, dayfirst=dayfirst, yearfirst=yearfirst)<EOL>tz = maybe_infer_tz(tz, inferred_tz)<EOL>int_as_wall_time = False<EOL><DEDENT><DEDENT>if is_datetime64tz_dtype(data):<EOL><INDENT>tz = maybe_infer_tz(tz, data.tz)<EOL>result = data._data<EOL><DEDENT>elif is_datetime64_dtype(data):<EOL><INDENT>data = getattr(data, "<STR_LIT>", data)<EOL>if data.dtype != _NS_DTYPE:<EOL><INDENT>data = conversion.ensure_datetime64ns(data)<EOL><DEDENT>if tz is not None:<EOL><INDENT>tz = timezones.maybe_get_tz(tz)<EOL>data = conversion.tz_localize_to_utc(data.view('<STR_LIT>'), tz,<EOL>ambiguous=ambiguous)<EOL>data = data.view(_NS_DTYPE)<EOL><DEDENT>assert data.dtype == _NS_DTYPE, data.dtype<EOL>result = data<EOL><DEDENT>else:<EOL><INDENT>if tz:<EOL><INDENT>tz = timezones.maybe_get_tz(tz)<EOL><DEDENT>if data.dtype != _INT64_DTYPE:<EOL><INDENT>data = data.astype(np.int64, copy=False)<EOL><DEDENT>if int_as_wall_time and tz is not None and not timezones.is_utc(tz):<EOL><INDENT>warnings.warn(_i8_message, FutureWarning, stacklevel=<NUM_LIT:4>)<EOL>data = conversion.tz_localize_to_utc(data.view('<STR_LIT>'), tz,<EOL>ambiguous=ambiguous)<EOL>data = data.view(_NS_DTYPE)<EOL><DEDENT>result = data.view(_NS_DTYPE)<EOL><DEDENT>if copy:<EOL><INDENT>result = result.copy()<EOL><DEDENT>assert isinstance(result, np.ndarray), type(result)<EOL>assert result.dtype == '<STR_LIT>', result.dtype<EOL>validate_tz_from_dtype(dtype, tz)<EOL>return result, tz, inferred_freq<EOL>
Parameters
----------
data : list-like
dtype : dtype, str, or None, default None
copy : bool, default False
tz : tzinfo, str, or None, default None
dayfirst : bool, default False
yearfirst : bool, default False
ambiguous : str, bool, or arraylike, default 'raise'
    See pandas._libs.tslibs.conversion.tz_localize_to_utc
int_as_wall_time : bool, default False
    Whether to treat ints as wall time in specified timezone, or as
    nanosecond-precision UNIX epoch (wall time in UTC).
    This is used in DatetimeIndex.__init__ to deprecate the wall-time
    behaviour.

    ..versionadded:: 0.24.0

Returns
-------
result : numpy.ndarray
    The sequence converted to a numpy array with dtype ``datetime64[ns]``.
tz : tzinfo or None
    Either the user-provided tzinfo or one inferred from the data.
inferred_freq : Tick or None
    The inferred frequency of the sequence.

Raises
------
TypeError : PeriodDType data is passed