I didn’t get the question properly, I might be able to help if you clarify what you mean by the patch maximizing the activation, possibly elucidate the example even more.
As far as storing the patches is concerned, once you find out which patch, you can create a dummy forward to obtain output tensor from that specific layer and thats actually the image you want. ( If what you want is the best kernel which is giving the max activation, then you can simply access the model parameters to get the kernel values)