TUTORIALAI & dataFETCHED

PyTorch torch.float_power 函数

PyTorch torch.float_power 函数 PyTorch torch.float_power 函数 Pytorch torch 参考手册 torch.float_power 是 PyTorch 中用于逐元素浮点幂运算的函数。 函数定义 torch.float_power(input, exponent, *, out=None) 使用示例 实例 [mycode4 type='python..

Updated 7/16/2026

Tutorial detail pages default to noindex.

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 参考手册