torch.nn.Conv2d()使用
torch NN 使用
2023-09-11 14:17:14 时间
API
输入:[ batch_size, channels, height_1, width_1 ]
Conv2d输入参数:[ channels, output, height_2, width_2 ]
输出:[ batch_size,output, height_3, width_3 ]
实例:
def torch_practice(): x = torch.randn(2,1,16,4) conv = torch.nn.Conv2d(1, 32, (2,2)) res = conv(x) print(res.shape) if __name__ == '__main__': torch_practice()
输出:torch.Size([2, 32, 15, 3])
batch大小不变:2
输出通道加厚:32。由卷积核的通道数决定
卷积结果:[15,3]。计算公式,n-m+1, 16-2+1=15
相关文章
- 【PyTorch】教程:torch.nn.Tanhshrink
- 【PyTorch】教程:torch.nn.Mish
- 【PyTorch】教程:torch.nn.Sigmoid
- 【PyTorch】教程:torch.nn.CELU
- 【PyTorch】教程:torch.nn.SELU
- 【PyTorch】教程:torch.nn.RReLU
- 【PyTorch】教程:torch.nn.PReLU
- 【PyTorch】教程:torch.nn.LogSigmoid
- 【PyTorch】教程:torch.nn.LeakyReLU
- 【PyTorch】教程:torch.nn.ModuleList
- 【PyTorch】教程:torch.nn (1)
- 成功解决torch.cuda.CudaError: CUDA driver version is insufficient for CUDA runtime version (35) [ WARN:0
- ModuleNotFoundError: No module named ‘torch‘解决方案python安装torch(python3.6+torch1.6)
- 判断torch.device是gpu还是cpu
- torch.bmm() 与 torch.matmul()==>张量的相乘运算
- torch.cuda.FloatTensor 与 torch.FloatTensor(torch.Tensor)--CPU和GPU上的数据类型
- 用torch.nn.Sequential()搭建神经网络模型
- torch.optim.SGD参数详解
- 在多分类任务实验中 用torch.nn实现 𝑳𝟐 正则化
- 利用torch.nn实现前馈神经网络解决 二分类 任务
- torch.nn.Embedding
- 利用torch.nn实现前馈神经网络解决 二分类 任务
- torch.nn.Sigmoid与torch.sigmoid
- 【Deepin 20系统】Linux系统VScode解决Module ‘torch‘ has no ‘cat‘ member
- module ‘torch.jit‘ has no attribute ‘unused‘问题
- torch expand