B
# -*- encoding: utf-8 -*-
"""
@File : 666.py
@Time : 2021-08-10 19:07
@Author : XD
@Email : gudianpai@qq.com
@Software: PyCharm
"""
import torch
from torch import nn
input = torch.randn(1,1,100,100)
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.cov1 = nn.Conv2d(in_channels = 1,out_channels = 1, kernel_size = (5,5), padding = 1, stride = 2)
self.pool = nn.MaxPool2d(kernel_size = (3,3), padding = 0, stride = 1)
self.cov2 = nn.Conv2d(in_channels = 1,out_channels = 1,kernel_size = (3,3), padding = 1,stride = 1)
def forward(self, x):
x = self.cov1(x)
x = self.pool(x)
x = self.cov2(x)
return x
net = Net()
output = net(input)
print(output.size())
torch.Size([1, 1, 47, 47])