TUTORIALAI & dataFETCHED
PyTorch torch.logaddexp2 函数
PyTorch torch.logaddexp2 函数 Pytorch torch 参考手册 torch.logaddexp2 是 PyTorch 中用于计算 log2(2^x + 2^y) 的函数。 函数定义 torch.logaddexp2(input, other) 使用示例 实例 [mycode4 type='python'] import torch # 计算 log2(2^x + 2..
Updated 7/16/2026
Tutorial detail pages default to noindex.
PyTorch torch.logaddexp2 函数
torch.logaddexp2 是 PyTorch 中用于计算 log2(2^x + 2^y) 的函数。
函数定义
torch.logaddexp2(input, other)
使用示例
实例
import torch
# 计算 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)
# 计算 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)
输出结果为:
logaddexp2: tensor([3.0875, 4.0236])
Pytorch torch 参考手册