当前位置:网站首页>F.pad 的妙用
F.pad 的妙用
2022-04-23 06:12:00 【wujpbb7】
F.pad 的使用参考 Pytorch之torch.nn.functional.pad函数详解 。
F.pad 可用在通道扩充上,在动态batch输入时,导出的onnx非常简洁。
# 简化的示例代码
import torch
import torch.nn.functional as F
x = torch.randn(1,3,5,4)
added_chan_num = 2
use_pad = True
if (not use_pad):
z = torch.zeros(1,added_chan_num,5,4)
x_a = torch.cat((x,z),dim=1)
else:
x_a = F.pad(x, (0,0,0,0,0,added_chan_num), 'constant', 0)
print(x_a)
onnx效果:

版权声明
本文为[wujpbb7]所创,转载请带上原文链接,感谢
https://blog.csdn.net/blueblood7/article/details/121013787
边栏推荐
- 【点云系列】Fully-Convolutional geometric features
- 【点云系列】Pointfilter: Point Cloud Filtering via Encoder-Decoder Modeling
- torch_geometric学习一,MessagePassing
- 【动态规划】杨辉三角
- WinForm scroll bar beautification
- PyTorch 21. PyTorch中nn.Embedding模块
- Chapter 1 numpy Foundation
- 机器学习 三: 基于逻辑回归的分类预测
- Record WebView shows another empty pit
- Solution to slow compilation speed of Xcode
猜你喜欢
![[point cloud series] a rotation invariant framework for deep point cloud analysis](/img/43/065d552d216b3e253d25dcfdfaaff4.png)
[point cloud series] a rotation invariant framework for deep point cloud analysis
树莓派:双色LED灯实验

1.2 preliminary pytorch neural network

SSL/TLS应用示例

【点云系列】点云隐式表达相关论文概要

PyTorch 10. 学习率
![[2021 book recommendation] kubernetes in production best practices](/img/78/2b5bf03adad5da9a109ea5d4e56b18.png)
[2021 book recommendation] kubernetes in production best practices

【点云系列】 场景识别类导读

1.1 pytorch and neural network

【点云系列】SG-GAN: Adversarial Self-Attention GCN for Point Cloud Topological Parts Generation
随机推荐
WebView displays a blank due to a certificate problem
C# EF mysql更新datetime字段报错Modifying a column with the ‘Identity‘ pattern is not supported
[dynamic programming] Yang Hui triangle
如何对多维矩阵进行标准化(基于numpy)
Visual studio 2019 installation and use
【动态规划】不同的二叉搜索树
Pytorch best practices and coding style guide
Keras如何保存、加载Keras模型
Machine learning II: logistic regression classification based on Iris data set
MySQL notes 4_ Primary key auto_increment
Exploration of SendMessage principle of advanced handler
PyTorch最佳实践和代码编写风格指南
Component learning (2) arouter principle learning
微信小程序 使用wxml2canvas插件生成图片部分问题记录
【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion
第2章 Pytorch基础1
面试总结之特征工程
What did you do during the internship
Summary of image classification white box anti attack technology
WebRTC ICE candidate里面的raddr和rport表示什么?