dpnp.tensor.astype¶
- dpnp.tensor.astype(usm_ary, newdtype, /, *, order='K', casting='unsafe', copy=True, device=None)[source]¶
Returns a copy of the
dpnp.tensor.usm_ndarray, cast to a specified type.- Parameters:
usm_ary (usm_ndarray) -- An input array.
newdtype (dtype) -- The data type of the resulting array. If None, gives default floating point type supported by device where the resulting array will be located.
order ({"C", "F", "A", "K"}, optional) --
Controls memory layout of the resulting array if a copy is returned.
Default:
"K".casting ({"no", "equiv", "safe", "same_kind", "unsafe"}, optional) --
Controls what kind of data casting may occur. Please see
numpy.ndarray.astype()for description of casting modes.Default:
"unsafe".copy (bool, optional) --
By default, astype always returns a newly allocated array. If this keyword is set to False, a view of the input array may be returned when possible.
Default:
True.device ({None, object}, optional) --
array API specification of device where the output array is created. Device can be specified by a filter selector string, an instance of
dpctl.SyclDevice, an instance ofdpctl.SyclQueue, or an instance ofdpnp.tensor.Device. If the value is None, returned array is created on the same device as usm_ary.Default:
None.
- Returns:
out -- An array with requested data type.
- Return type:
Notes
A view can be returned, if possible, when copy=False is used.