mindspore.ops.logaddexp

View Source On Gitee
mindspore.ops.logaddexp(input, other)[source]

Computes the logarithm of the sum of exponentiations of the inputs. This function is useful in statistics where the calculated probabilities of events may be too small (exceed the range of normal floating point numbers).

outi=log(exp(inputi)+exp(otheri))
Parameters
  • input (Tensor) – The input tensor.

  • other (Tensor) – The input tensor.

Returns

Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> x1 = mindspore.tensor([1, 2, 3], mindspore.float16)
>>> x2 = mindspore.tensor(2, mindspore.float16)
>>> output = mindspore.ops.logaddexp(x1, x2)
>>> print(output)
[2.312 2.693 3.312]