当前位置:网站首页>pytorch index_ select
pytorch index_ select
2022-07-19 01:16:00 【phac123】
- torch.index_select(input, dim, index, *, out=None)
- This function returns a tensor
- Parameters
- input(Tensor), Input tensor
- dim(int): need tensor The specified dimension of
- index (IntTensor or LongTensor) – the 1-D tensor containing the indices to index
Code instance :
x = torch.randn(3, 4)
x
indices = torch.tensor([0, 2])
torch.index_select(x, 0, indices)
torch.index_select(x, 1, indices)
''' tensor([[ 0.1427, 0.0231, -0.5414, -1.0009], [-0.4664, 0.2647, -0.1228, -1.1068], [-1.1734, -0.6571, 0.7230, -0.6004]]) tensor([[ 0.1427, 0.0231, -0.5414, -1.0009], [-1.1734, -0.6571, 0.7230, -0.6004]]) tensor([[ 0.1427, -0.5414], [-0.4664, -0.1228], [-1.1734, 0.7230]]) '''
reference :pytorch file
边栏推荐
猜你喜欢

json相关图形

Watermelon book chapter 4

CLI and vite realize cross domain through proxy

Introduction to MySQL DLJD Lao Du

IDEA开发Servlet项目 如何右键创建servlet

Detailed evaluation of current popular redis visual management tools

Tool version number

在mysql数据库插入中文值出现的乱码解决

20210519-LeetCode-双指针
![[Linux] release jar package, dynamically view logs, view program progress, and end programs](/img/ae/4e1e2ab160acf388372cd684d62c5d.png)
[Linux] release jar package, dynamically view logs, view program progress, and end programs
随机推荐
mysql的逻辑架构
西瓜书第三章(第一次&第二次)
Solve the garbled code when inserting Chinese values in MySQL database
Markdown various mathematical symbols
【MySQL】ERROR 1130 问题解决方案
西瓜书+南瓜书第1-2章
數學03-導數與微分(待補)
华为云服务器
BeanFactory 和 ApplicationContext的区别
Pytorch使用nn实现softmax回归
西瓜书第四章
20210520-TCP滑动窗口
PHP upload pictures
2022.7.1
在mysql數據庫插入中文值出現的亂碼解决
vs_mpi
@ConfigurationProperties注解使用
flutter项目中 advance_image_picker 组件使用
mysql入门基础-dljd-老杜
openpyxl 绘制雷达图