TUTORIALAI & dataFETCHED

PyTorch torch.positive 函数

PyTorch torch.positive 函数 Pytorch torch 参考手册 torch.positive 是 PyTorch 中用于逐元素取正的函数。返回输入张量本身。 函数定义 torch.positive(input) 使用示例 实例 [mycode4 type='python'] import torch # 逐元素取正 x = torch.tensor([1.0, 2.0,..

Updated 7/16/2026

Tutorial detail pages default to noindex.

PyTorch torch.positive 函数


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

torch.positive 是 PyTorch 中用于逐元素取正的函数。返回输入张量本身。

函数定义

torch.positive(input)

使用示例

实例

import torch

# 逐元素取正
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.positive(x)
print(result)

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