libtorch 数组索引和张量操作 与pytorch比较
时间:2021-09-02 05:46:53
收藏:0
阅读:23
数组索引
-
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})
原文:https://www.cnblogs.com/ggs403/p/15213289.html
评论(0)