Generalize LeNet with user-specified number of layers and filters