BVLC/caffe — pull request #99 by lin-min (2014-02-12 11:07:50+00:00)
Title: implemented padding aware im2col and col2im functions

Implemented padded_im2col and padded_col2im for both GPU and CPU versions. Convolution layer and im2col layers are updated to use the padded version when the pad parameter is not zero. To use, just remove padding layers and add parameter "pad" to the convolution layer.

In the case of imagenet, removing the padding layer reduces the device memory usage from 3700M to 3100M saving about 600M memory.

According to the benchmark (https://github.com/BVLC/caffe/pull/85), padding layers in imagenet takes about 3% of the total execution time for GPU mode. Removing the padding layer is not gonna improve the speed a lot. On the other hand, padded_im2col adds operation to the kernel code. Thus the speed is not gonna improve, or just negligible if there is. On my Titan card, code with padding runs 50 batches in 70s, without padding improves 1s to 69s.