mindspore.ops.expm1

mindspore.ops.expm1(x)[source]

Returns exponential then minus 1 of a tensor element-wise.

\[out_i = e^{x_i} - 1\]
Parameters

x (Tensor) – The input tensor with a dtype of float16 or float32, its rank must be in [0, 7] inclusive.

Returns

Tensor, has the same shape as the x.

Raises
  • TypeError – If x is not a Tensor.

  • TypeError – If dtype of x is neither float16 nor float32.

Supported Platforms:

Ascend GPU CPU

Examples

>>> x = Tensor(np.array([0.0, 1.0, 2.0, 4.0]), mindspore.float32)
>>> output = ops.expm1(x)
>>> print(output)
[ 0.        1.718282  6.389056 53.598152]