mindspore.ops.logaddexp2

mindspore.ops.logaddexp2(x1, x2)[source]

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

\[out_i = log_2(2^{x1_i} + 2^{x2_i})\]
Parameters
  • x1 (Tensor) – Input tensor.

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

Returns

Tensor.

Raises

TypeError – If x1, x2 is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> 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]