logaddexp2(x1, x2, dtype=None)¶
Logarithm of the sum of exponentiations of the inputs in base of 2.
log2(2**x1 + 2**x2). This function is useful in machine learning when the calculated probabilities of events may be so small as to exceed the range of normal floating point numbers. In such cases the base-2 logarithm of the calculated probability can be used instead. This function allows adding probabilities stored in such a fashion.
Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.
Tensor or scalar. This is a scalar if both x1 and x2 are scalars.
- Supported Platforms:
>>> import mindspore.numpy as np >>> x1 = np.array([2, 4, 8]).astype('float16') >>> x2 = np.array(2).astype('float16') >>> output = np.logaddexp2(x1, x2) >>> print(output) [3. 4.32 8.02]