Pooling factory

This is a PR to address the comments at #1170.
This does not compile for me, 

This does:
CHECK_EQ(this->pad_h_, 0);