mindspore.ops.logaddexp2

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

Computes the logarithm of the sum of exponentiations in base of 2 of the inputs.

\[out_i = \log_2(2^{input_i} + 2^{other_i})\]
Parameters
  • input (Tensor) – Input tensor. The dtype of input must be float.

  • other (Tensor) – Input tensor. The dtype of other must be float. If input.shape != other.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

Returns

Tensor.

Raises
  • TypeError – If input, other is not a Tensor.

  • TypeError – If the dtype of input, other is not a float.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> x1 = Tensor(np.array([2, 4, 8]).astype(np.float16))
>>> x2 = Tensor(np.array([2]).astype(np.float16))
>>> output = ops.logaddexp2(x1, x2)
>>> print(output)
[3. 4.32 8.02]