The gradient should be the same:
x = Variable(torch.rand(1,1,2,2), requires_grad=True)
avgpool = nn.AvgPool2d(2,2)

y = x.mean()
y.backward()
print(x.grad)
x.grad.zero_()
z = avgpool(x)
z.backward()
print(x.grad)