I'm making a convolution (1D, 2D and 3D) implementation that applies im2col (The unfold operation in the PyTorch library) to a zero-padded kernel instead of the input, to then multiply to the flattened input to give the result of the convolution. However, I'm running into the problem that the unfolded kernel requires a lot of memory, since it has a lot of zeros. Is there an equivalent to PyTorch's unfold operation that generates a sparse matrix, instead of a dense one? Continue reading...