index_select为例子
torch.index_select(input, dim, index, out=None)
- 功能:在维度dim上,按index索引数据
- 返回值:依index索引数据拼接的张量...- index:要索引的张量
- dim:要索引的维度
- index:要索引数据的序号
x = torch.randn(3, 4)
print(x)
indices =...0.8797]])
tensor([[ 0.2274, -2.1934, -0.3129, 0.3869],
[-0.8007, -0.0095, 0.8703, -0.8797]])
2.numpy...中 以mean为例
x = numpy.random.randint(1,10,(3,4))
print(x)
print(x.mean(0))
y = numpy.random.randint(