【发布时间】:2021-01-08 02:48:33
【问题描述】:
有什么方法可以在多个维度上应用 torch.mode
例如
import numpy as np
import torch
x = np.random.randint(10, size=(3, 5))
y = torch.tensor(x)
假设你有
[[6 3 7 3 0]
[2 5 7 9 7]
[6 1 4 6 3]]
torch.mode 应该返回一个大小为 3 的张量 [3,7,6]
不使用循环
【问题讨论】:
-
如果你在你的例子中使用
torch.mode,你会得到你想要的。你能再举一个例子吗?
标签: python numpy machine-learning pytorch