火炬,如何选择张量的子集? [英] Torch, how to select a subset of a tensor?

查看:77
本文介绍了火炬,如何选择张量的子集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有一个张量t = torch.rand(10,1).我想在{1,3,7,9}行中选择张量子集,并将它们连接为新张量.有什么优雅的方法吗?谢谢.

For example, I have a tensor t = torch.rand(10,1). And I want to select the tensor subset of at the rows of {1,3,7,9} and concatenate them as new tensor. Is there any elegant way? Thank you.

推荐答案

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆