padding aware im2col and col2im functions

This PR is to replace https://github.com/BVLC/caffe/pull/99