exp2#
- ivy.exp2(x, /, *, out=None)[source]#
Calculate 2**p for all p in the input array.
- Parameters:
- Return type:
- Returns:
ret – Element-wise 2 to the power x. This is a scalar if x is a scalar.
Examples
>>> x = ivy.array([1, 2, 3]) >>> ivy.exp2(x) ivy.array([2., 4., 8.]) >>> x = [5, 6, 7] >>> ivy.exp2(x) ivy.array([32., 64., 128.])
- Array.exp2(self, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.exp2. This method simply wraps the function, and so the docstring for ivy.exp2 also applies to this method with minimal changes.
- Parameters:
self (
Union[Array,float,list,tuple]) – Array-like input.out (
Optional[Array], default:None) – optional output array, for writing the result to.
- Return type:
Array- Returns:
ret – Element-wise 2 to the power x. This is a scalar if x is a scalar.
Examples
>>> x = ivy.array([1, 2, 3]) >>> x.exp2() ivy.array([2., 4., 8.]) >>> x = [5, 6, 7] >>> x.exp2() ivy.array([32., 64., 128.])
- Container.exp2(self, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.exp2. This method simply wraps the function, and so the docstring for ivy.exp2 also applies to this method with minimal changes.
- Parameters:
self (
Container) – container with the base input arrays.out (
Optional[Container], default:None) – optional output container, for writing the result to.
- Return type:
Container- Returns:
ret – Container including arrays with element-wise 2 to the power of input array elements.
Examples
>>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=[5, 6, 7]) >>> x.exp2() { a: ivy.array([2., 4., 8.]) b: ivy.array([32., 64., 128.]) }