当前位置:网站首页>Pytorch deep learning -- neural network convolution layer conv2d
Pytorch deep learning -- neural network convolution layer conv2d
2022-06-10 20:47:00 【Hair will grow again without it】
torn.nn.Conv2d
stay Official documents You can view the parameters
Code example :
import torch
import torchvision
from torch import nn
from torch.nn import Conv2d
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
dataset = torchvision.datasets.CIFAR10("./data", train=False, transform=torchvision.transforms.ToTensor(), download=True)
dataloader = DataLoader(dataset, 64)
class MyMoudle(nn.Module):
def __init__(self):
super(MyMoudle, self).__init__()
self.conv1 = Conv2d(3, 6, 3, stride=1, padding=0)
def forward(self, x):
x = self.conv1(x)
return x
Myconv = MyMoudle()# neural network
writer = SummaryWriter("logs")
step = 0
for data in dataloader:
imgs, target = data
output = Myconv(imgs)
writer.add_images("input", imgs, step)
output = torch.reshape(output, (-1, 3, 30, 30))# Because it was (XX, 6, 30, 30)6 individual channel Will report a mistake
writer.add_images("output", output, step)
writer.close()
Output :
边栏推荐
- 移动端渲染原理浅析
- Microsoft Word 教程,如何在 Word 中更改页面方向、为页面添加边框?
- 游戏兼容性测试(通用方案)
- 功耗开发经验分享:设计功耗大板
- JD released ted-q, a large-scale and distributed quantum machine learning platform based on tensor network acceleration
- Mixin -- mixed
- mysql基础篇
- The most common habits from more than 200 English papers written by gradua
- Tutoriel Microsoft Word "5", comment changer les marges de page et créer une barre de nouvelles en word?
- Redis cluster form - sentry mode cluster and high availability mode cluster - redis learning notes 003
猜你喜欢
随机推荐
localhost和127.0.0.1的区别?
PDU session flow
Microsoft Word 教程「5」,如何在 Word 中更改頁邊距、創建新聞稿欄?
P5723 [deep base 4. example 13] prime number pocket
Canvas advanced functions (Part 1)
Key points of lldp protocol preparation
【电脑使用】如何设置没有自启项的软件开机启动
Solve the problem that the idea automatically becomes * when there are more than 5 identical packages
解决idea超过5个相同包的时候自动变成*的问题
[FAQ] summary of common problems and solutions during the use of rest API interface of sports health service
为什么网页样式属性,有的需要加冒号“:”,有的不用?
详解三级缓存解决循环依赖
Elastic-Job的快速入门,三分钟带你体验分布式定时任务
Four methods to obtain the position index of the first n values of the maximum and minimum values in the list
搭建一个BPMN建模的Web服务
synergy: server refused client with our name
Recommend a crud tool that may become the best crud tool in 2019 during the National Day
Li Kou 10821084 solution_ Question of SQL query type
Mobile power supply scheme for outdoor solar camping lamp
Microsoft Word 教程,如何在 Word 中更改页面方向、为页面添加边框?











