PyTorch torch.logaddexp2 Function
Pytorch torch Reference Manual
torch.logaddexp2It is a function in PyTorch used to calculate log2(2^x + 2^y).
Function Definition
torch.logaddexp2(input, other)
Usage Example
Example
import torch
# Calculate log2(2^x + 2^y)
x = torch.tensor([1.0, 2.0])
y = torch.tensor([3.0, 4.0])
z = torch.logaddexp2(x, y)
print("logaddexp2:", z)
# Calculate log2(2^x + 2^y)
x = torch.tensor([1.0, 2.0])
y = torch.tensor([3.0, 4.0])
z = torch.logaddexp2(x, y)
print("logaddexp2:", z)
The output result is:
logaddexp2: tensor([3.0875, 4.0236])
Other Extensions