seung-lab / znn-release

Multi-core CPU implementation of deep learning for 2D and 3D sliding window convolutional networks (ConvNets).
GNU General Public License v3.0
94 stars 33 forks source link

Which class do you use to compute multi-stride convolutions? #96

Closed Jokeren closed 8 years ago

Jokeren commented 8 years ago

I know your framework must support multi-stride convolution like the first layer in Alexnet, where the stride is set to 4 other than 1.

However, by skimming your project, I cannot understand the way you use to compute the convolution layer.

For instance, in Convolve_mkl.hpp, these configurations are only applicable for single-stride convolution.

    const int start[3]={s[2]-1,s[1]-1,s[0]-1};

    MKL_INT bshape[3] = { s[2], s[1], s[0] };
    MKL_INT rshape[3] = { shape[0] + 1 - s[2],
                          shape[1] + 1 - s[1],
                          shape[2] + 1 - s[0] };

There are two questions:

  1. Can you help me understand your method in multi-stride convolution? You can present files involving the operation or some docs for further explanation.
  2. Can you explain how this framework select between fft and naive method by auto-tuning?

Thank you very much!

torms3 commented 8 years ago
  1. Convolution with non-unit stride s is equivalent to convolution with unit stride, followed by down-sampling with a factor of s. In ZNN, down-sampling is replaced with "sparse convolution" (see Figure 2 and related text in Zlateski et al. 2015). This is equivalent to "dilated convolution" in Yu & Koltun 2015, "filter rarefaction" in Long et al. 2015, "d-regularly sparse kernel" in Li et al. 2014, and "strided kernel" in Tschopp 2015.
  2. We first set all the layers to use FFT and measure its speed, and then switch to naive convolution in each layer and measure its speed, one layer at a time (layer-wise greedy optimization).