卷积层 conv2d操作实例 mport torch import torchvision from torch.utils.tensorboard import SummaryWriter from P10 import nn from P10.nn import output dataset = torchvision.datasets.CIFAR10("../data", train=False ,transform=torchvision.transforms.ToTensor(), download=True) def Dataloader(dataset, batch_size): pass dataloader = Dataloader(dataset,batch_size=64) class Szx(nn.Module): def __init__(self, in_channels3=None): super(Szx, self).__init__() self.conv1 = nn.Conv2d(in_channels3, out_channels=6, kernel_size=3, stride=1, padding=0) def forward(self,x): x = self.conv1(x) return x Szx = Szx() writer = SummaryWriter("../logs") stro = 0 for data in dataloader: imgs, targets = data outputs = Szx(imgs) print(imgs.shape) assert isinstance(output.shape, object) print(output.shape)
卷积层conv2d操作实例
最新推荐文章于 2024-09-10 13:01:50 发布