mindspore.numpy.logaddexp

mindspore.numpy.logaddexp(x1, x2, dtype=None)[source]

Logarithm of the sum of exponentiations of the inputs. Calculates log(exp(x1) + exp(x2)).

Note

Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.

Parameters
  • x1 (Tensor) – Input array.

  • x2 (Tensor) – Input array. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

  • dtype (mindspore.dtype) – Default: None. Overrides the dtype of the output Tensor.

Returns

Tensor or scalar. This is a scalar if both x1 and x2 are scalars.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore.numpy as np
>>> x1 = np.array([1, 2, 3]).astype('float16')
>>> x2 = np.array(2).astype('float16')
>>> output = np.logaddexp(x1, x2)
>>> print(output)
[2.312 2.693 3.312]