# bitwise_xor#

ivy.bitwise_xor(x1, x2, /, *, out=None)[source]#

Compute the bitwise XOR of the underlying binary representation of each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.

Special cases

This function does not take floating point operands

Parameters:
• x1 (`Union`[`int`, `bool`, `Array`, `NativeArray`]) – first input array. Should have an integer or boolean data type.

• x2 (`Union`[`int`, `bool`, `Array`, `NativeArray`]) – second input array. Must be compatible with `x1` (see broadcasting). Should have an integer or boolean data type.

• out (`Optional`[`Array`]) – optional output array, for writing the result to. It must have a shape that the (default: `None`) inputs broadcast to.

Return type:

`Array`

Returns:

ret – an array containing the element-wise results. The returned array must have a data type determined by type-promotion.

This function conforms to the Array API Standard. This docstring is an extension of the docstring # noqa in the standard.

Both the description and the type hints above assume an array input for simplicity, but this function is nestable, and therefore also accepts `ivy.Container` instances in place of any of the arguments.

Functional Examples

With `ivy.Array` input:

```>>> a = ivy.array([1, 2, 3])
>>> b = ivy.array([3, 2, 1])
>>> y = ivy.bitwise_xor(a, b)
>>> print(y)
ivy.array([2, 0, 2])
```
```>>> a = ivy.array([78, 91, 23])
>>> b = ivy.array([66, 77, 88])
>>> ivy.bitwise_xor(a, b, out=y)
>>> print(y)
ivy.array([12, 22, 79])
```
```>>> a = ivy.array([1, 2, 3])
>>> b = ivy.array([3, 2, 1])
>>> ivy.bitwise_xor(a, b, out = a)
>>> print(a)
ivy.array([2, 0, 2])
```

With a mix of `ivy.Array` and `ivy.NativeArray` inputs:

```>>> a = ivy.array([0, 1, 3, 67, 91])
>>> a = ivy.native_array([4, 7, 90, 89, 98])
>>> y = ivy.bitwise_xor(a, b)
>>> print(y)
ivy.array([0,0,0,0,0])
```

With `ivy.Container` input:

```>>> x = ivy.Container(a = ivy.array())
>>> y = ivy.Container(a = ivy.array())
>>> z = ivy.bitwise_xor(x, y)
>>> print(z)
{
a:ivy.array()
}
```

With a mix of `ivy.Array` and `ivy.Container` inputs:

```>>> x = ivy.Container(a = ivy.array([-67, 21]))
>>> b = ivy.array([78, 34])
>>> y = ivy.array([12, 13])
>>> z = ivy.bitwise_xor(x, y)
>>> print(z)
{
a: ivy.array([-79, 24])
}
```
Array.bitwise_xor(self, x2, /, *, out=None)#

ivy.Array instance method variant of ivy.bitwise_xor. This method simply wraps the function, and so the docstring for ivy.bitwise_xor also applies to this method with minimal changes.

Parameters:
• self (`Array`) – first input array. Should have an integer or boolean data type.

• x2 (`Union`[`Array`, `NativeArray`]) – second input array. Must be compatible with `self` (see broadcasting). Should have an integer or boolean data type.

• out (`Optional`[`Array`]) – optional output array, for writing the result to. It must have a shape that (default: `None`) the inputs broadcast to.

Return type:

`Array`

Returns:

ret – an array containing the element-wise results. The returned array must have a data type determined by type-promotion.

Examples

```>>> a = ivy.array([[89, 51, 32], [14, 18, 19]])
>>> b = ivy.array([[[19, 26, 27], [22, 23, 20]]])
>>> y = a.bitwise_xor(b)
>>> print(y)
ivy.array([[[74,41,59],[24,5,7]]])
```
Container.bitwise_xor(self, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#

ivy.Container instance method variant of ivy.bitwise_xor. This method simply wraps the function, and so the docstring for ivy.bitwise_xor also applies to this method with minimal changes.

Parameters:
• self (`Container`) – first input array or container. Should have an integer or boolean data type.

• x2 (`Union`[`Container`, `Array`, `NativeArray`]) – second input array or container Must be compatible with `self` (see broadcasting). Should have an integer or boolean data type.

• key_chains (`Optional`[`Union`[`List`[`str`], `Dict`[`str`, `str`]]]) – The key-chains to apply or not apply the method to. Default is `None`. (default: `None`)

• to_apply (`bool`) – If True, the method will be applied to key_chains, otherwise key_chains (default: `True`) will be skipped. Default is `True`.

• prune_unapplied (`bool`) – Whether to prune key_chains for which the function was not applied. (default: `False`) Default is `False`.

• map_sequences (`bool`) – Whether to also map method to sequences (lists, tuples). (default: `False`) Default is `False`.

• out (`Optional`[`Container`]) – optional output container, for writing the result to. It must have a shape (default: `None`) that the inputs broadcast to.

Return type:

`Container`

Returns:

ret – a container containing the element-wise results. The returned container must have a data type determined by type-promotion.

Examples

```>>> x = ivy.Container(a = ivy.array(), b = ivy.array())
>>> y = ivy.Container(a = ivy.array(), b = ivy.array())
>>> z = x.bitwise_xor(y)
>>> print(z)
{
a: ivy.array(),
b: ivy.array()
}
```