r"""Element-wise :math:`\log(e^x + e^y)` function. This function is useful in statistics where the calculated probabilities of events may be so small as to exceed the range of normal floating point numbers. In such cases the logarithm of the calculated probability is stored. This f
(x: Tensor, y: Tensor)
| 825 | |
| 826 | |
| 827 | def logaddexp(x: Tensor, y: Tensor) -> Tensor: |
| 828 | r"""Element-wise :math:`\log(e^x + e^y)` function. |
| 829 | |
| 830 | This function is useful in statistics where the calculated probabilities of events may be so small |
| 831 | as to exceed the range of normal floating point numbers. |
| 832 | In such cases the logarithm of the calculated probability is stored. |
| 833 | This function allows adding probabilities stored in such a fashion. |
| 834 | |
| 835 | Args: |
| 836 | x: input tensor. Should have a floating-point data type. |
| 837 | y: input tensor. Must be compatible with :math:`x`` (see :ref:`broadcasting-rule` ). Should have a floating-point data type. |
| 838 | |
| 839 | Returns: |
| 840 | a tensor containing the evaluated result for each element in :math:`x` and :math:`y`. |
| 841 | The returned tensor must have a floating-point data type determined by :ref:`dtype-promotion`. |
| 842 | |
| 843 | Examples: |
| 844 | >>> prob1 = F.log(1e-10) |
| 845 | >>> prob2 = F.log(2e-10) |
| 846 | >>> F.logaddexp(prob1, prob2) |
| 847 | Tensor(-21.927238, device=xpux:0) |
| 848 | """ |
| 849 | return _elwise(x, y, mode=Elemwise.Mode.LOG_SUM_EXP) |
| 850 | |
| 851 | |
| 852 | def round(x): |