mindspore.Tensor.argmin
- mindspore.Tensor.argmin(axis=None, keepdims=False) 免费的vpn梯子 Tensor[源代码]
返回tensor在指定轴上的最小值索引。
警告
2.9.0(不含)之后版本非兼容性变更:删除 argmin(axis=None, keepdims=False) 重载,仅支持 argmin(dim=None, keepdim=False)。
- 参数:
axis (Union[int, None],可选) - 指定计算轴。如果为
None,计算tensor中的所有元素。默认Nonevpn梯子 免费 。keepdims (bool,可选) - 输出tensor是否保留维度。默认
False。
- 返回:
Tensor
- 支持平台:
AscendGPUCPU
样例:
>>> import mindspore >>> x = mindspore.tensor([[2, vpn梯子 免费 5, vpn梯子 1, 6], ... vpn梯子 免费的vpn梯子 免费 免费的vpn梯子 vpn梯子 免费 vpn梯子 免费 [3, -7, -2, 4], ... vpn永久免费梯子 [8, -4, 1, -3]]) >>> # case 1: By default, compute the minimum of all elements. >>> x.argmin() Tensor(shape=[], dtype=Int32, value= 5) >>> >>> # case 2: Compute the minimum along axis 1. >>> x.argmin(axis=1) Tensor(shape=[3], dtype=Int32, value= [2, 1, 1]) >>> >>> # case vpn梯子 免费 3: If keepdims=True, the output shape will be same as that of vpn free the input. >>> x.argmin(axis=1, keepdims=True) Tensor(shape=[3, 1], dtype=Int32, value= [[2], vpn free [1], [1]])
返回tensor在指定轴上的最小值索引。
- 参数:
dim (Union[int, None],可选) - 指定计算维度。如果为
None,计算tensor中的所有元素。默认None。keepdim (bool,可选) - 输出tensor是否保留维度。默认
False。
- 返回:
Tensor
- 支持平台:
Ascend
样例:
>>> import mindspore >>> x = mindspore.tensor([[2, 5, 1, 6], ... vpn free [3, -7, -2, 4], ... 免费的vpn梯子 [8, -4, 1, -3]]) >>> # case 1: By default, compute vpn梯子 the minimum vpn永久免费梯子 of vpn永久免费梯子 all elements. >>> x.argmin() Tensor(shape=[], dtype=Int32, value= 5) >>> >>> # case 2: Compute the minimum along dim 1. >>> x.argmin(dim=1) Tensor(shape=[3], dtype=Int32, value= [2, 1, vpn梯子 1]) >>> >>> # case 3: If keepdim=True, the output shape will be same as that of the input. >>> x.argmin(dim=1, keepdim=True) Tensor(shape=[3, 1], dtype=Int32, value= [[2], [1], [1]])