Erro :RuntimeError: pad should be at most half of kernel size, but got pad=1 and kernel_size=1

from torch import nn

构建模型

class CIFAR_10(nn.Module):
def init(self,int_shape:int,heddin_shape:int,out_shape:int):
super().init()
self.Conv_Baock_1 = nn.Sequential(
nn.Conv2d(in_channels=int_shape,
out_channels=heddin_shape,
kernel_size=3,
stride=1,
padding=0),
nn.ReLU(),
nn.Conv2d(in_channels=heddin_shape,
out_channels=heddin_shape,
kernel_size=3,
stride=1,
padding=0),
nn.ReLU(),
nn.MaxPool2d(kernel_size=1,padding=1)
)
self.classLiner = nn.Sequential(
nn.Flatten(),
nn.Linear(in_features=heddin_shape,
out_features=out_shape)
)

def forward(self,x):
    x = self.Conv_Baock_1(x)
    print(x.shape)
    x = self.classLiner(x)
    return x

The nn.MaxPool2d layer is failing:

pad = nn.MaxPool2d(kernel_size=1,padding=1)
pad(x)
# # RuntimeError: pad should be at most half of effective kernel size, but got pad=1, kernel_size=1 and dilation=1

Increase the kernel_size or remove this layer, since a kernel_size of 1 won’t do anything and will be a no-op.