adapted for maxPoolingFragment, but gradient check seems to fail. There still seems to be something wrong with placement of subgradients