数组索引
-
libtorch
torch::Tensor idx=torch::zeros({270,360});
torch::Tensor t=torch::zeros({255});
//idx里的值作为t的索引
torch::Tensor out=t.index({idx}) -
python
out=t[idx]
张量索引
1.python
t[i,j]
2.libtorch
t.index({i,j})
2023-10-17 12:20:58
libtorch
torch::Tensor idx=torch::zeros({270,360});
torch::Tensor t=torch::zeros({255});
//idx里的值作为t的索引
torch::Tensor out=t.index({idx})
python
out=t[idx]
1.python
t[i,j]
2.libtorch
t.index({i,j})
下一篇:贪心算法入门——区间问题