torch.minimum torch.minimum(input, other, *, out=None) → Tensor 计算input和other的元素-wise最小值。 计算input和other的元素级最小值。 注意 如果比较的元素中包含 NaN,则返回该元素。不支持 minimum() 用于具有复数数据类型的张量。 参数 input (Tensor) – 需要输入的张量。 other (Tensor) – 输入的第二个张量 关键字参数 out (Tensor, 可选) – 指定输出张量。 示例: >>> a = torch.tensor((1, 2, -1)) >>> b = torch.tensor((3, 0, 4)) >>> torch.minimum(a, b) tensor([1, 0, -1])