代码拉取完成,页面将自动刷新
The following mapping relationships can be found in this file.
PyTorch APIs | MindSpore APIs |
---|---|
torch.amin | mindspore.ops.amin |
torch.Tensor.amin | mindspore.Tensor.amin |
torch.amin(input, dim, keepdim=False, *, out=None) -> Tensor
For more information, see torch.amin.
mindspore.ops.amin(x, axis=(), keepdims=False) -> Tensor
For more information, see mindspore.ops.amin.
PyTorch: Find the minimum element of input
according to the specified dim
. keepdim
controls whether the output and the input have the same dimension. out
can get the output.
MindSpore: Find the minimum element of x
according to the specified axis
. The keepdims
function is identical to PyTorch. MindSpore does not have out
parameter. MindSpore axis
has a default value, and finds the minimum value of all elements of x
if axis
is the default value.
Categories | Subcategories | PyTorch | MindSpore | Differences |
---|---|---|---|---|
Parameters | Parameter 1 | input | x | Same function, different parameter names |
Parameter 2 | dim | axis | MindSpore axis has a default value, while PyTorch dim has no default value |
|
Parameter 3 | keepdim | keepdims | Same function, different parameter names | |
Parameter 4 | out | - | PyTorch out can get the output. MindSpore does not have this parameter |
# PyTorch
import torch
input = torch.tensor([[1, 2, 3], [3, 2, 1]], dtype=torch.float32)
print(torch.amin(input, dim=0, keepdim=True))
# tensor([[1., 2., 1.]])
# MindSpore
import mindspore
x = mindspore.Tensor([[1, 2, 3], [3, 2, 1]], dtype=mindspore.float32)
print(mindspore.ops.amin(x, axis=0, keepdims=True))
# [[1. 2. 1.]]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。