评价此页

torch.minimum#

torch.minimum(input, other, *, out=None) Tensor#

计算 inputother 的逐元素最小值。

注意

如果被比较的元素之一是 NaN,则返回该元素。torch.minimum() 不支持具有复数 dtype 的张量。

参数
  • input (Tensor) – 输入张量。

  • other (Tensor) – 第二个输入张量

关键字参数

out (Tensor, optional) – 输出张量。

示例

>>> a = torch.tensor((1, 2, -1))
>>> b = torch.tensor((3, 0, 4))
>>> torch.minimum(a, b)
tensor([1, 0, -1])