torch.max()函数
torch.max()
torch.max(input, dim, keepdim=False) → output tensors (max, max_indices)
输入参数:
input = 输入tensor
dim = 求最大值的维度
keepdim = 是否保持原维度大小输出
输出:
max = 指定维度求得的最大值
max_indices = 指定维度求得的最大值索引
下面以一个大小为(3, 2, 5)的张量为例:
当dim = 0时
import torch
x = torch.rand(3,
原创
2022-05-06 10:41:10 ·
9855 阅读 ·
0 评论