restricts portable behavior for prepend and append to arrays. While NumPy and others support scalars (a common use case), PyTorch does not support scalars.
supports all numeric dtypes (real and complex floats, signed and unsigned integers).
allows some wiggle room for array libraries supporting "exotic" dtypes, such as datetimes, by stating that the output array "should" have the same data type as the input array x. E.g., NumPy supports datetimes and returns timedeltas. For numeric dtypes, the output array should always have the same dtype.
restricts prepend and append to the same data type as the input array. If we more generally allow any combination of dtypes among x, prepend, and append, we'd need to consider type promotion semantics. We don't have much, if any, precedent in the specification for array kwargs causing an input array to upcast, and I don't think we should establish precedent here.
set the defaults for prepend and append to None. This is in contrast to NumPy which doesn't set a default value.
This PR
diff
to the specification.prepend
andappend
to arrays. While NumPy and others support scalars (a common use case), PyTorch does not support scalars.x
. E.g., NumPy supports datetimes and returns timedeltas. For numeric dtypes, the output array should always have the same dtype.prepend
andappend
to the same data type as the input array. If we more generally allow any combination of dtypes amongx
,prepend
, andappend
, we'd need to consider type promotion semantics. We don't have much, if any, precedent in the specification for array kwargs causing an input array to upcast, and I don't think we should establish precedent here.prepend
andappend
toNone
. This is in contrast to NumPy which doesn't set a default value.