PyTorch torch.min 函数
torch.min 是 PyTorch 中用于计算张量最小值的函数。
函数定义
torch.min(input, dim, keepdim, out)
使用示例
实例
import torch
x = torch.tensor([[1, 2, 3], [4, 5, 6]])
print("全局最小:", torch.min(x))
print("dim=0 最小:", torch.min(x, dim=0))
x = torch.tensor([[1, 2, 3], [4, 5, 6]])
print("全局最小:", torch.min(x))
print("dim=0 最小:", torch.min(x, dim=0))

Pytorch torch 参考手册