評價此頁

torch.cummin#

torch.cummin(input, dim, *, out=None)#

返回一個命名元組 (values, indices),其中 valuesinputdim 維度上的累積最小值。而 indices 是在 dim 維度上找到的每個最大值的索引位置。

yi=min(x1,x2,x3,,xi)y_i = min(x_1, x_2, x_3, \dots, x_i)
引數
  • input (Tensor) – 輸入張量。

  • dim (int) – 進行操作的維度

關鍵字引數

out (tuple, optional) – the result tuple of two output tensors (values, indices)

示例

>>> a = torch.randn(10)
>>> a
tensor([-0.2284, -0.6628,  0.0975,  0.2680, -1.3298, -0.4220, -0.3885,  1.1762,
     0.9165,  1.6684])
>>> torch.cummin(a, dim=0)
torch.return_types.cummin(
    values=tensor([-0.2284, -0.6628, -0.6628, -0.6628, -1.3298, -1.3298, -1.3298, -1.3298,
    -1.3298, -1.3298]),
    indices=tensor([0, 1, 1, 1, 4, 4, 4, 4, 4, 4]))