oneflow.expm1¶
-
oneflow.
expm1
()¶ Returns a new tensor with the exponential of the elements minus 1 of
input
.The equation is:
\[y_{i} = e^{x_{i}} - 1\]- Parameters
input (oneflow.Tensor) – A Tensor.
- Returns
The result Tensor
- Return type
For example:
>>> import oneflow as flow >>> import numpy as np >>> x = flow.tensor(np.array([1, 2, 3]).astype(np.float32)) >>> y = flow.expm1(x) >>> y.shape oneflow.Size([3]) >>> y tensor([ 1.7183, 6.3891, 19.0855], dtype=oneflow.float32) >>> x = flow.tensor(np.array([[[2, 4, 6],[7, 8, 9]],[[10,11,12],[13,14,15]]]).astype(np.float32)) >>> y = flow.expm1(x) >>> print(y.shape) oneflow.Size([2, 2, 3]) >>> print(y.numpy()) [[[6.3890562e+00 5.3598152e+01 4.0242880e+02] [1.0956332e+03 2.9799580e+03 8.1020840e+03]] [[2.2025465e+04 5.9873141e+04 1.6275380e+05] [4.4241238e+05 1.2026032e+06 3.2690165e+06]]]