现在位置: 首页 > PyTorch 教程 > 正文
PyTorch torch.float_power 函数

PyTorch torch.float_power 函数


Pytorch torch 参考手册 Pytorch torch 参考手册

torch.float_power 是 PyTorch 中用于逐元素浮点幂运算的函数。

函数定义

torch.float_power(input, exponent, *, out=None)

使用示例

实例

import torch

# 浮点幂运算示例
x = torch.tensor([2.0, 3.0, 4.0])
y = torch.tensor([2.0, 2.0, 2.0])
result = torch.float_power(x, y)
print(result)  # tensor([4., 9., 16.])

Pytorch torch 参考手册 Pytorch torch 参考手册