当前位置:网站首页>torch.nn.utils.rnn.pad_sequence()详解【Pytorch入门手册】
torch.nn.utils.rnn.pad_sequence()详解【Pytorch入门手册】
2022-06-10 15:34:00 【K同学啊】
函数原型
torch.nn.utils.rnn.pad_sequence(sequences, batch_first=False, padding_value=0.0)
函数功能
此函数返回大小为 T x B x * 或 B x T x * 的张量,其中 T 是最长序列的长度。
参数详解
sequences (list[Tensor]): 可变长度序列的列表,shape=[batch_size, N],N长度不一。batch_first (bool, optional):默认batch_size在第一维度padding_value (float, optional):填充的值,默认为0。
示例
from torch.nn.utils.rnn import pad_sequence
a = torch.ones(25, 300)
b = torch.ones(22, 300)
c = torch.ones(15, 300)
pad_sequence([a, b, c]).size()
输出
torch.Size([25, 3, 300])
边栏推荐
- 这几个垂直类小众导航网站,你绝对不会想错过
- 22. Generate Parentheses
- ORB_SLAM2视觉惯性紧耦合定位技术路线与代码详解0——整体框架与理论基础知识
- 如何写一个全局的 Notice 组件?
- Tensorflow actual combat Google deep learning framework version 2 learning summary tensorflow installation
- MapReduce之Map阶段的join操作案例
- 产品设计软件Figma用不了,国内有哪些相似功能的软件
- 使用特定大小、分辨率或背景色保存图窗
- TensorFlow实战Google深度学习框架第二版学习总结-TensorFlow安装
- Vins Theory and Code detail 4 - Initialization
猜你喜欢

2290. Minimum Obstacle Removal to Reach Corner

CentOS Linux is dead! Oracle Linux may be a better alternative
![Google X开源抓取机械臂,无需人工标注就能一眼找到目标零件[转]](/img/69/02a3e0eeaf3049f41b118cf0c58972.jpg)
Google X开源抓取机械臂,无需人工标注就能一眼找到目标零件[转]

ORB_SLAM2视觉惯性紧耦合定位技术路线与代码详解1——IMU流型预积分

Anba cv2fs/cv22fs obtained ASIL C chip function safety certification, surpassing the level of similar chips in the market

RK3308 按键Key与LED灯

VINS理论与代码详解4——初始化
![姿态估计之2D人体姿态估计 - Human Pose Regression with Residual Log-likelihood Estimation(RLE)[仅链接]](/img/c7/9c25da07236ef0bd241b6023e82306.gif)
姿态估计之2D人体姿态估计 - Human Pose Regression with Residual Log-likelihood Estimation(RLE)[仅链接]

You will never want to miss these vertical niche navigation websites

What has guanghetong done in the three years of 5g business from "seeding in the first generation" to "flower on the ground"?
随机推荐
Yuntu says that every successful business system cannot be separated from apig
MapReduce案例之聚合求和
Li Kou daily question - day 18 -350 Intersection of two data Ⅱ
广和通高算力智能模组为万亿级市场5G C-V2X注智
姿态估计之2D人体姿态估计 - Numerical Coordinate Regression with Convolutional Neural Networks(DSNT)
Vins Theory and Code detail 4 - Initialization
[sans titre]
“绽放杯”5G应用奖项大满贯!广和通多个联合项目荣获通用产品专题赛一、二、三等奖
统一认证中心 Oauth2 认证坑
How to open an account for agricultural futures? Are there any financial conditions?
MySQL8安装详细步骤
Guanghetong high computing power intelligent module injects intelligence into 5g c-v2x in the trillion market
Technology sharing | quick intercom, global intercom
Sword finger offer 06 Print linked list from end to end
Cap version 6.1 Release Notice
苹果式中文:似乎表达清楚意思了,懂了没完全懂的苹果式宣传文案
Cube 技术解读 | Cube 渲染设计的前世今生
Using GDB to quickly read the kernel code of PostgreSQL
Kubernetes 1.24: avoid conflicts when assigning IP addresses to services
TensorFlow实战Google深度学习框架第二版学习总结-TensorFlow安装