haojin2 commented on a change in pull request #15857: [Numpy] Added operator 
logaddexp; added support for zero-size tensor in BinaryBroadcastBackwardUseIn 
URL: https://github.com/apache/incubator-mxnet/pull/15857#discussion_r314497609
 
 

 ##########
 File path: python/mxnet/ndarray/numpy/_op.py
 ##########
 @@ -293,3 +293,51 @@ def power(x1, x2, out=None):
         This is a scalar if both x1 and x2 are scalars.
     """
     return _ufunc_helper(x1, x2, _npi.power, _np.power, _npi.power_scalar, 
_npi.rpower_scalar, out)
+
+
+@set_module('mxnet.ndarray.numpy')
+def logaddexp(x1, x2, out=None):
+    """Logarithm of the sum of exponentiations of the inputs.
+    logaddexp(x1, x2, out=None)
+     Calculates ``log(exp(x1) + exp(x2))``. 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 function
+    allows adding probabilities stored in such a fashion.
+     Parameters
+    ----------
+    x1, x2 : ndarray or scalar
+        Input values.
+    out : ndarray, None, or tuple of ndarray and None, optional
+        A location into which the result is stored. If provided, it must have
+        a shape and dtype as the expected output. If not provided or `None`,
+        a freshly-allocated array is returned.
+     Returns
+    -------
+    result : ndarray or scalar
+        Logarithm of ``exp(x1) + exp(x2)``.
+        This is a scalar if both `x1` and `x2` are scalars.
+     See Also
+    --------
+    logaddexp2: Logarithm of the sum of exponentiations of inputs in base 2.
+     Notes
+    -----
+    This function differs from the original `numpy.logaddexp2
+    
<https://docs.scipy.org/doc/numpy/reference/generated/numpy.logaddexp2.html>`_ 
in
 
 Review comment:
   Same for the link.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to