libtorch 数组索引和张量操作 与pytorch比较
数组索引
-
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})
mx
浙公网安备 33010602011771号