r"""Element-wise :math:`e^x` function. Calculates an approximation to the exponential function for each element :math:`x_i` of the input tensor :math:`x` (:math:`e` raised to the power of :math:`x_i`, where :math:`e` is the base of the natural logarithm). This function has domain
(x)
| 590 | |
| 591 | |
| 592 | def exp(x): |
| 593 | r"""Element-wise :math:`e^x` function. |
| 594 | |
| 595 | Calculates an approximation to the exponential function for each element :math:`x_i` of the input tensor :math:`x` |
| 596 | (:math:`e` raised to the power of :math:`x_i`, where :math:`e` is the base of the natural logarithm). |
| 597 | |
| 598 | This function has domain ``[-infinity, +infinity]`` and codomain ``[+0, +infinity]``. |
| 599 | |
| 600 | Args: |
| 601 | x: input tensor. Should have a floating-point data type. |
| 602 | |
| 603 | Returns: |
| 604 | a tensor containing the evaluated exponential function result for each element in :math:`x`. |
| 605 | The returned tensor must have a floating-point data type determined by :ref:`dtype-promotion`. |
| 606 | |
| 607 | .. admonition:: Special cases |
| 608 | |
| 609 | For floating-point operands, |
| 610 | |
| 611 | * If :math:`x_i` is ``NaN``, the result is ``NaN``. |
| 612 | * If :math:`x_i` is ``+0``, the result is ``1``. |
| 613 | * If :math:`x_i` is ``-0``, the result is ``1``. |
| 614 | * If :math:`x_i` is ``+infinity``, the result is ``+infinity``. |
| 615 | * If :math:`x_i` is ``-infinity``, the result is ``+0``. |
| 616 | |
| 617 | Examples: |
| 618 | |
| 619 | >>> F.exp([0, F.log(2)]) |
| 620 | Tensor([1. 2.], device=xpux:0) |
| 621 | |
| 622 | """ |
| 623 | return _elwise(x, mode=Elemwise.Mode.EXP) |
| 624 | |
| 625 | |
| 626 | def expm1(x): |