dpnp.invert
- dpnp.invert(x, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)
Inverts (flips) each bit for each element x_i of the input array x.
For full documentation refer to
numpy.invert.- Parameters:
x ({dpnp.ndarray, usm_ndarray}) -- Input array, expected to have integer or boolean data type.
out ({None, dpnp.ndarray, usm_ndarray}, optional) -- Output array to populate. Array must have the correct shape and the expected data type. Default:
None.order ({"C", "F", "A", "K"}, optional) -- Memory layout of the newly output array, if parameter out is
None. Default:"K".
- Returns:
out -- An array containing the element-wise results. The data type of the returned array is same as the data type of the input array.
- Return type:
dpnp.ndarray
Limitations
Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise
NotImplementedErrorexception will be raised.See also
dpnp.bitwise_andCompute the bit-wise AND of two arrays element-wise.
dpnp.bitwise_orCompute the bit-wise OR of two arrays element-wise.
dpnp.bitwise_xorCompute the bit-wise XOR of two arrays element-wise.
dpnp.logical_notCompute the truth value of NOT x element-wise.
Examples
>>> import dpnp as np >>> x = np.array([13]) >>> np.invert(x) -14
>>> a = np.array([True, False]) >>> np.invert(a) array([False, True])
The
~operator can be used as a shorthand forinvertondpnp.ndarray.>>> ~a array([False, True])