AI Hardware & Software Stack
Why are convolutions in CNNs sometimes converted into matrix multiplications, for example with im2col?
- AConversion reduces the operation count tenfold
- BSo that highly optimized matrix-multiplication libraries and matrix units such as tensor cores can be used
- CConversion always reduces memory usage
Show answer and explanation
Answer: B. So that highly optimized matrix-multiplication libraries and matrix units such as tensor cores can be used
im2col builds a large matrix in which the input values of each convolution window are laid out as a column, then computes the convolution as a product with a matrix of filters. Overlapping windows duplicate input values and increase memory, but decades-optimized matrix-multiplication libraries and matrix units such as tensor cores can be used directly, so it is often faster overall. Some implementations achieve the same effect without materializing the duplicates.
- A. The operation count is unchanged.
- B. Correct. Rearranging the input increases memory, though.
- C. im2col duplicates input data, so memory actually increases.