Reputation: 106
Original input activations undergo kernel transformation through im2col to improve memory access patterns. But, when we are converting the original matrix into im2col matrix, then also we are accessing the same original memory patters. So, why im2col operation itself isn't slow?
Upvotes: 0
Views: 729
Reputation: 20418
The im2col preprocessing runtime is proportional to the size of the image, whereas the naive 2d convolution runtime proportional to the size of the image times the number of filters. So if the number of output channels is N, naive 2d convolution will be N times slower than im2col. Thus, if N is large, im2col will be well-worth it.
Upvotes: 0
Reputation: 2117
The main reason for im2col is that the input and kernels can be represented as two big matrices and the convolution can be done in a single matrix multiplication. This speeds up the process because a matrix multiplication can be parallelized very well.
Just the memory access is not the problem and as you said im2col has to access the original tensors the same way a simple convolution operation would.
Upvotes: 0