2_ Oh ok, I get it now. But that's not what the program is doing. I don't generate a vector for the single layer I am maximizing, I generate an image and run the whole CNN from input to that layer, all through. Then I optimize for that layer's output.
Edit to add: As stated in the post, when I "maximize for a filter", the exact function I am maximizing is the average output for that filter over the whole image.