import torch
from torch import nn
from d2l import torch as d2l
# 实现池化层的正向传播
def pool2d(X, pool_size, mode='max'):
p_h, p_w = pool_size
Y = torch.zeros((X.shape[0] - p_h + 1, X.shap
import torch
from torch import nn
from d2l import torch as d2l
# 实现池化层的正向传播
def pool2d(X, pool_size, mode='max'):
p_h, p_w = pool_size
Y = torch.zeros((X.shape[0] - p_h + 1, X.shap